Errata

Learning Rails: Live Edition

Errata for Learning Rails: Live Edition

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
Page 41
example 4.2 code

<% form_tag :action => 'sign_in' do %>

requires "="

<%= form_tag :action => 'sign_in' do %>

Note from the Author or Editor:
Yes, this shifted between Rails 2.x and 3.x. It's fixed in Learning Rails 3.

RODOLFO LOMASCOLO  Dec 31, 2011 
PDF, Other Digital Version
Page 366
Code at top of page

This line:

@result = addThem (1, 2)

Results in this error:

/Users/jet/work/ruby/testbed/app/controllers/testbed_controller.rb:3: syntax error, unexpected ',', expecting ')'
@result = addThem (1, 2)
^
/Users/jet/work/ruby/testbed/app/controllers/testbed_controller.rb:7: syntax error, unexpected $end, expecting keyword_end

Changing the line to read

@result = addThem(1, 2)

Makes the code work (removed space).

I am using:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
Rails 2.3.11

I downloaded the .pdf and .mobi files today just to be sure I had the latest versions.

Note from the Author or Editor:
Sorry, an extra space crept in. It's been deleted!

JayT2  Aug 27, 2011 
PDF
Page 279
1st paragraph, 1st and 2nd block of code

Ruby code is using camelcase (aB) method name instead of snake case (a_b).

This

map.taxonomy 'taxonomy/*steps' :controller => 'taxonomy', action => 'showTree'

should be

map.taxonomy 'taxonomy/*steps' :controller => 'taxonomy', action => 'show_tree'

This

def showTree
steps = params [:steps]
....
end

should be

def show_tree
steps = params [:steps]
....
end

Note from the Author or Editor:
Style issue, but yes, fixed.

skim  Nov 18, 2010 
PDF
Page 34
Example 3-9 and Example 3-10

For some reason the code doesn't work,

content_for(:list)

i'm talking about, no matter what I try
it seems to be html escaped in the output which is:
<ol> <li>This message came from the controller.</li> <li>This message came from the controller.</li> <li>This message came from the controller.</li> </ol>

and the source:
<ol>

<li>This message came from the controller.</li>

<li>This message came from the controller.</li>

<li>This message came from the controller.</li>

</ol>

How can this be solved?

I noticed that putting 'raw' in it didn't work (saw that in a stackoverflow question)

Note from the Author or Editor:
rails versioning issue, now fixed in Learning Rails 3.

paintrick  May 25, 2010 
PDF
Page xviii preface
end of paragaph

are notes in a few places pointing out where things may look a little different
in different versions. We?ll post updates in new versions of this electronic book
and at http://www.excursionsonrails.com.


going to the above mentioned URL states:

It works!

I'm trying to find the sample code for the book.

Note from the Author or Editor:
Site was broken, fixed now.

Anonymous  May 04, 2010 
many
many

the default controller in 2.3.5 is app/controllers/application_controller.rb, not app/controllers/application.rb

Anonymous  Apr 23, 2010 
PDF
Page 265
all over the book

Probably a dozen references to "app/controllers/application.rb" which should actually be "app/controllers/application_controller.rb". THe one where it started tripping me up a bit was on page 265 but I did a search and found it like that all over.

mwhalen  Mar 20, 2010 
PDF
Page 130
5th Code Example

The second line of the code example contains:
:url => { :action => ( @person.new_record? ? "create" : "update" ) },,

The second comma causes an error in Ruby.

Removing the comma fixes the issue.

Note from the Author or Editor:
Fixed.

fotios  Mar 16, 2010 
PDF
Page 133
paragraph 2, "

The problem is that this paragraph (2nd p.133) has us do a migration:

To run the migration, just run rake db:migrate as usual. The Rake tool will find the new migration file, know that it hasn?t run it yet, and add the column to the existing :people table, as requested.

which is repeated later on page 136:

It?s time to try this code. Running rake db:migrate updates the database:
== 2 AddPhotoExtensionToPerson: migrating ========================
-- add_column(:people, :extension, :string)
-> 0.0757s
== 2 AddPhotoExtensionToPerson: migrated (0.0759s) ===============

Doing the migration the second time does not return the above result. It is actually blank because you've already done it once.

Note from the Author or Editor:
Nice catch! I removed the duplication.

Micah  Mar 10, 2010