Learning Rails 3

Errata for Learning Rails 3

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
PDF, Other Digital Version
Page xv
Rails Versions

This book was updated for Rails 3.2.3 and Rails 1.9.2. should say This book was updated for Rails 3.2.3 and Ruby 1.9.2.

Note from the Author or Editor:
Yes, this is definitely correct. That's Ruby 1.9.2.

Michael Simpson  May 24, 2012 
PDF
Page 22-23
Example 3-3

It seems that in Rails 3.1, stylesheets are no longer supposed to be placed in public/stylesheets. The new location now seems to be in /app/assets/stylesheets.

Note from the Author or Editor:
Thank you - you are correct, though it's actually even more complicated than that. The update to the early release will cover this shortly!

Anonymous  Sep 22, 2011 
PDF
Page 30
Example 3-9

The left angle and right angle brackets in the example were swapped. For example, one of the tags is misprinted as >!DOCTYPE html<

Note from the Author or Editor:
Argh. Completely right, and very embarassing. Fixed!

GiantMarshmallow  Sep 23, 2011 
PDF
Page 49
Tip on top of the page, last line

Only "bundle exec" should be in constant width, as "run" is not part of the command... [jiehan@jiehan-tpx300 testing]$ run bundle exec rake db:migrate bash: run: command not found... ^C

Note from the Author or Editor:
Thanks! Fixed!

Jiehan Zheng  Jun 25, 2012 
PDF
Page 52
find last - next paragraph

The find last description says the same thing as "find first" = 'will return the first matching value only'. Isn't that supposed to be the LAST matching value only? Otherwise how is this different than find first?

Note from the Author or Editor:
You're completely right. That should be: "return the last matching value only". Thank you!

Tim Chambers  Aug 15, 2012 
PDF
Page 90
footnote

The url is wrong I believe: 1. From the API docs (http://api.rubyonrails.com/classes/ActionView/Helpers/FormHelper.html/). should be: 1. From the API docs (http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html). Need to change .com to .org and DROP the final "/".

Note from the Author or Editor:
Strange. I can see how the stray / got there, but the .com / .org switch is strange. This should be: http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html

Tim Chambers  Aug 15, 2012 
PDF
Page 111
2nd paragraph under "The Power of Declarative Validation"

I would suggest a small clarification that this validation code goes in person.rb, after attr_accessible and before "end"; it's not entirely clear from the current early release version. I had to look at the downloadable source to confirm that's where it's supposed to go.

Note from the Author or Editor:
Thank you - I just added it!

Anonymous  Jul 01, 2012 
PDF
Page 111
Note about other resources re: regular expressions

You note: Regular expressions are a complex subject you can study to nearly infinite depth. Appendix C can get you started. Jeffrey Friedl’s Mastering Regular Expressions (O’Reilly, 2006) is pretty much the classic overview of the field, but Tony Stubblebine’s Regular Expression Pocket Refer- ence (O’Reilly, 2007) is a concise guide to the capabilities and syntax in different environments. ---- You should also note the new book Introducing Regular Expressions by Michael Fitzgerald - July 2012 - available at O'Reilly is IMO a very good and current reference and a great intro. I have no affiliation, but it is a fresh book and more current.

Note from the Author or Editor:
Yes, we should add that. It wasn't available at the time I was writing, though I was editing it and definitely like it!

Tim Chambers  Aug 15, 2012 
PDF
Page 152
Last line of the page

The URL that it links to "http://blog.hasmanythrough.com/2007/7/14/validate-your-existence" is no longer valid.

Note from the Author or Editor:
Argh. That's sad. Changing the prose to lose the reference.

Jiehan Zheng  Jul 06, 2012 
PDF
Page 153
First code sample

The text says: Near the top of the config/routes.rb file are the lines: map.resources :awards map.resources :students Delete them, and replace them with: map.resources :students, :has_many => [ :awards ] the generated files that rails produced say: resources :awards resources :students There is no reference to a map object. I'm using: $ rails -v 3.0.3 $ ruby -v ruby 1.8.7 (20011-06-30 patchlevel 352) [i686-linux] If I replace the lines with resources :students, :has_many => [ :awards ] then the exception undefined local variable or method 'map' for #<ActionDispatch::Routing::Mapper:0xb75cdffc> goes away and the URL localhost:3000/students/1 starts working. So this seems like a typo. For some reason localhost:3000/students/1/awards/1 still isn't working. That's probably not a problem with the text.

Note from the Author or Editor:
Sorry - this was a shift from version 2 to version 3 that got by us for this chapter at the time. Fixed now.

Russell Owen  Oct 31, 2011 
PDF, Other Digital Version
Page 160
Example 9-3, line 2

Example 9-3 has <% if !@student.awards.empty? > 0 %> which didn't work until I omitted the "> 0" e.g. <% if !@student.awards.empty? %>

Note from the Author or Editor:
This is correct - we need to strike the >0.

rjr20  Jul 08, 2012 
Other Digital Version
1634
Example 4-2, Example 4-7

Example 4-2 has <h1>Hello <%= @name %></h1> while Example 4-7 <h1>Hello <%=h @name %></h1> What does <%=h mean? (NB I entered the kindle location number in the page number box above because I don't have the page number, sorry if that causes any trouble.)

Note from the Author or Editor:
The h was from an older version of Rails. It doesn't break anything, but I've taken all of them out.

RebeccaR  Jul 05, 2012