Ruby on Rails: Up and Running by Bruce A. Tate, Curt Hibbs This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated March 15, 2007. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: {10} last paragraph (3rd line from bottom of page) Edit the new controller at the path app/controller/greeting_controller.rb: should be Edit the new controller at the path app/controllers/greeting_controller.rb: (12) Example 1-1, line 3 of code;

Welcome to your first Rails application

should be

Welcome to your first Rails application

{14} end of page; app/view/greeting/index.rhtml should be app/views/greeting/index.rhtml (15) First Code Example; class GreetingController < ApplicationController def index @age=8 @table={"headings" => ["addend", "addend", "sum"], "body" => [[1, 1, 2], [1, 2, 3], [ 1, 3, 4]] } end end Won't compile: should use single quotes: class GreetingController < ApplicationController def index @age=8 @table={'headings' => ['addend', 'addend', 'sum'], 'body' => [[1, 1, 2], [1, 2, 3], [ 1, 3, 4]] } end end [24] 2/3 down; The code "rake migrate" will produce a deprecation notice when executed. It should be "rake db:migrate". (30) Fig. 2.3, under Class: Photographer < Person; type"Person" should be type"Photographer" (32) class Person; [:state, :State] should be [:state, :state] {37} last paragraph before example at bottom; db/migrate/create_slideshow.rb should be db/migrate/002_create_slideshows.rb (38) Figure 3-1; Class: Person should be Class: Slide (39) 2nd sentence in footnote; text fixtures should be test fixtures (41) 2nd text paragraph; you can to see should be you can see (42) in the sidebar on Cascading Relationships, the following line has a syntax error: has_many :line_items, dependent => true should be has_many :line_items, :dependent => true (42) Table 3-2, last row, Description column; photo.slides.clear should be photo.slides.empty? (45) Final paragraph; Redundant text. "But we're not ready to run the migration until we've created our model objects and defined the relationships between photos and categories. You can't run the migration yet, though. There's no model class for photos, and no relationship between Photo and Category." [46] 5th text paragraph (ignoring code listings); On page 39, we create slideshow_data.sql. On page 46 it is refered to as photos_data.sql. Also on page 46, it doesn't specifically say that once the new data is appended to the .sql file we need to do "rake migrate VERSION=0" and then "rake migrate" again (because otherwise you end up inserting the same data over again). {47} First code example under "Join Models"; has_many :photos :through => :slides should be has_many :photos, :through => :slides Also this wouldn't work unless there was also a has_many :slides line in the model. (48) Figure 3-5, in Class: Slide; slideshow should be slideshow_id {48} Code block; acts_as_list :scope => "slideshow_id" Should be acts_as_list :scope => :slideshow_id (50) Table 3-3; The code examples for move_higher and move_lower are reversed. (50) 2nd sentence of 1st paragraph (1st line under "Trees"); you could implement... should be You could implement... (54) 4th bullet point; ...to jumpstarts your development. shoudl be ...to jumpstart your development. {55} 3rd text paragraph; photo_controller.rb should be photos_controller.rb {62} Middle of the page; The text instructs the reader to "look at one of the views. Open app/views/photos/list.rhtml..." It then goes on to present the code from show.rhtml, not list.rhtml. That should be replaced with the code from photos/list.rhtml. Note that we should also change: - the next paragraph should say tthe 'show' method - the paragraph after the explanation should say show.rhtml ("...if we add more properties, the show.rhtml view won't require any modification to display them.") (65) 2nd paragraph; rapidly take shape. should be rapidly takes shape. (66) Item 10; rendering elements than are used... should be rendering elements that are used... (71) 4th paragraph (excluding code listings); it makes the h call look more like its part of the tag. should be it makes the h call look more like it's part of the tag. (83) 1st paragraph (excluding code listings); Finally, it assigns a @selected a list of IDs should be Finally, it assigns to @selected a list of IDs (86) 2/3rds down the page; The 3 sections explaining the code end with colons and not periods. This is misleading because they are referring to the code above them, not following them. That is: "You saw this line before in the photos list template. It loops through each database row contained in @slideshows (which was set by the controller), assigning each, in turn, to slideshow:" should end with a period and not a colon. Also: "This div is simply a caption block that displays the name of the slideshow along with the number of photos it contains:" should end with a period and not a colon. And: "This div shows a little preview of the slideshow by displaying the thumbnails of the first three photos in the slideshow:" should end with a period and not a colon. [95] 2nd paragraph; Now show a slideshow by loading slideshow/list and clicking Show should be Now show a slideshow by loading slideshow/list and clicking Play {96} Bottom code example on the page; update_slide_order method looks for template and gives errors. It should also contain render :nothing => true (97) CSS listing half-way down page; The line "padding: 0.50em;" is repeated unnecessarily in the listing for slideshows.css. (101) Paragraph that starts with Finally,; Finally, notice two Ajax related helpers: drop_receiving_element and observe_field. should be Finally, notice the Ajax-related helper drop_receiving_element. (129) 3rd paragraph ("Windows"); ...plus the Rad Rails IDE. should be ...plus the RadRails IDE. (The latter is used in the same sentence and the remainder of Appendix A.) (130) Top; Step number three; ...update the paths in the all of the configuration files. should be ...update the paths in all of the configuration files. (130) 4th paragraph; During development, it is easiest use Ruby's... should be During development, it is easiest to use Ruby's... (163) Ajax listing in index, line 1; JavaScrpt should be JavaScript