Errata

Ruby on Rails: Up and Running

Errata for Ruby on Rails: Up and Running

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 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:

Anonymous   
Printed
Page 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:

Anonymous   
Printed
Page 12
Example 1-1, line 3 of code

<h1>Welcome to your first Rails application<h1>
should be
<h1>Welcome to your first Rails application</h1>

Anonymous   
Printed
Page 12
Example 1-1, line 3 of code

<h1>Welcome to your first Rails application<h1>
should be
<h1>Welcome to your first Rails application</h1>

Anonymous   
Printed
Page 14
end of page

app/view/greeting/index.rhtml
should be
app/views/greeting/index.rhtml

Anonymous   
Printed
Page 14
end of page

app/view/greeting/index.rhtml
should be
app/views/greeting/index.rhtml

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 24
2/3 down

The code "rake migrate" will produce a deprecation notice when executed.
It should be "rake db:migrate".

Anonymous   
Printed
Page 24
2/3 down

The code "rake migrate" will produce a deprecation notice when executed.
It should be "rake db:migrate".

Anonymous   
Printed
Page 30
Fig. 2.3, under Class: Photographer < Person

type"Person"
should be
type"Photographer"

Anonymous   
Printed
Page 30
Fig. 2.3, under Class: Photographer < Person

type"Person"
should be
type"Photographer"

Anonymous   
Printed
Page 32
class Person

[:state, :State]
should be
[:state, :state]

Anonymous   
Printed
Page 32
class Person

[:state, :State]
should be
[:state, :state]

Anonymous   
Printed
Page 37
last paragraph before example at bottom

db/migrate/create_slideshow.rb
should be
db/migrate/002_create_slideshows.rb

Anonymous   
Printed
Page 37
last paragraph before example at bottom

db/migrate/create_slideshow.rb
should be
db/migrate/002_create_slideshows.rb

Anonymous   
Printed
Page 38
Figure 3-1

Class: Person
should be
Class: Slide

Anonymous   
Printed
Page 38
Figure 3-1

Class: Person
should be
Class: Slide

Anonymous   
Printed
Page 39
2nd sentence in footnote

text fixtures
should be
test fixtures

Anonymous   
Printed
Page 39
2nd sentence in footnote

text fixtures
should be
test fixtures

Anonymous   
Printed
Page 41
2nd text paragraph

you can to see
should be
you can see

Anonymous   
Printed
Page 41
2nd text paragraph

you can to see
should be
you can see

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 42
Table 3-2, last row, Description column

photo.slides.clear
should be
photo.slides.empty?

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 42
Table 3-2, last row, Description column

photo.slides.clear
should be
photo.slides.empty?

Anonymous   
Printed
Page 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."

Anonymous   
Printed
Page 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."

Anonymous   
Printed
Page 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).

Anonymous   
Printed
Page 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).

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 48
Figure 3-5, in Class: Slide

slideshow
should be
slideshow_id

Anonymous   
Printed
Page 48
Code block

acts_as_list :scope => "slideshow_id"
Should be
acts_as_list :scope => :slideshow_id

Anonymous   
Printed
Page 48
Figure 3-5, in Class: Slide

slideshow
should be
slideshow_id

Anonymous   
Printed
Page 48
Code block

acts_as_list :scope => "slideshow_id"
Should be
acts_as_list :scope => :slideshow_id

Anonymous   
Printed
Page 50
Table 3-3

The code examples for move_higher and move_lower are reversed.

Anonymous   
Printed
Page 50
2nd sentence of 1st paragraph (1st line under "Trees")

you could implement...
should be
You could implement...

Anonymous   
Printed
Page 50
Table 3-3

The code examples for move_higher and move_lower are reversed.

Anonymous   
Printed
Page 50
2nd sentence of 1st paragraph (1st line under "Trees")

you could implement...
should be
You could implement...

Anonymous   
Printed
Page 54
4th bullet point

...to jumpstarts your development.
shoudl be
...to jumpstart your development.

Anonymous   
Printed
Page 54
4th bullet point

...to jumpstarts your development.
shoudl be
...to jumpstart your development.

Anonymous   
Printed
Page 55
3rd text paragraph

photo_controller.rb
should be
photos_controller.rb

Anonymous   
Printed
Page 55
3rd text paragraph

photo_controller.rb
should be
photos_controller.rb

Anonymous   
Printed
Page 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.")

Anonymous   
Printed
Page 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.")

Anonymous   
Printed
Page 65
2nd paragraph

rapidly take shape.
should be
rapidly takes shape.

Anonymous   
Printed
Page 65
2nd paragraph

rapidly take shape.
should be
rapidly takes shape.

Anonymous   
Printed
Page 66
Item 10

rendering elements than are used...
should be
rendering elements that are used...

Anonymous   
Printed
Page 66
Item 10

rendering elements than are used...
should be
rendering elements that are used...

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 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

Anonymous   
Printed
Page 96
Bottom code example on the page

update_slide_order method looks for template and gives errors.
It should also contain render :nothing => true

Anonymous   
Printed
Page 96
Bottom code example on the page

update_slide_order method looks for template and gives errors.
It should also contain render :nothing => true

Anonymous   
Printed
Page 97
CSS listing half-way down page

The line "padding: 0.50em;" is repeated unnecessarily in the listing for
slideshows.css.

Anonymous   
Printed
Page 97
CSS listing half-way down page

The line "padding: 0.50em;" is repeated unnecessarily in the listing for
slideshows.css.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 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.)

Anonymous   
Printed
Page 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.)

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 130
4th paragraph

During development, it is easiest use Ruby's...
should be
During development, it is easiest to use Ruby's...

Anonymous   
Printed
Page 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.

Anonymous   
Printed
Page 130
4th paragraph

During development, it is easiest use Ruby's...
should be
During development, it is easiest to use Ruby's...

Anonymous   
Printed
Page 163
Ajax listing in index, line 1

JavaScrpt
should be
JavaScript

Anonymous   
Printed
Page 163
Ajax listing in index, line 1

JavaScrpt
should be
JavaScript

Anonymous