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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
Printed Page 10
last paragraph

I've downloaded and installed InstantRails (v2.0) on Windows all as Appendix A (pages 129 and 130). I then proceeded to work through Chapter 1 and create the simple 'Greeting' application.

the book says 'Edit the new controller at the path app/controller/greeting_controller.rb'

In fact, the path is 'app/controllers' (i.e. plural) and in order to edit the new controller, I've figured out you have to type 'edit greeting_controller.rb'.

Also, when I do edit the Controller, exactly as Example 1-1 on page 12, I don't get the 'Welcome to your first Rails application' message, but instead I get the message 'SyntaxError in GreetingController#index
C:/InstantRails/rails_apps/chapter-1/app/controllers/greeting_controller.rb:3: unterminated string meets end of file
C:/InstantRails/rails_apps/chapter-1/app/controllers/greeting_controller.rb:3: syntax error, unexpected $end, expecting kEND'

Also, according to the middle of page 14, the index file that gets created should be 'app/views/greeting/index.rhtml'. However, in my case the file is 'app/views/greeting/index.html.erb'. Is this is an error in the book, or has the software moved on?

Personally, I think it's poor to find these eroors and inconsistenies on the very first chapter of a book designed to get the reader 'Up and Running' on Rails. I am not up and running on Rails and don't think ever will be if I follow your book.

Graham Stow  Feb 16, 2009 
Printed Page 23
bottom

The database scaffolding code on p23 does not specify an id field, but the photos.yml presented assumes an id field. So, on pg 24, rke db:fixtures:load fails.

Anonymous  Oct 31, 2008 
Printed Page 43
Table 3-2

The right column entries for <associations>.build and .create are incorrect. The code for <associations>.build should be:

photo = slide.photos.build( :filename => "cat.jpg", ... )

A similar change is required for .create.
The code needs correction, but the text is correct.



Oz DiGennaro  Apr 02, 2012 
Printed Page 49
example code

I defined the Slide class as shown after correcting "slideshow_id" to :slideshow_id. But when I executed the second line in the example code I received:

>> show.slides.each {|slide| puts slide.photo.filename}
NoMethodError: undefined method `acts_as_list' for #<Class:0x1980fe8>

I checked the Rails documentation and could not find the acts_as_list method.

Irwin Friedman  Mar 03, 2011 
Printed Page 49

I would like to retract the previous comments I made on March 3, 2011 and replace them with this. After a bit more digging, I discovered that I had to install the gems acts_as_list and acts_as_tree, update the environment.rb file by adding: config.gem "acts_as_list"
config.gem "acts_as_tree" and then running rake gems:install. Perhaps this is an unusual circumstance and most Ruby installations have them by default. But mine was provided by default by Apple (Snow Leopard).

Irwin Friedman  Mar 05, 2011 
Printed Page 50
categories.yml file content

I found that categories.yml contains "parent_id: nil" that creates 0 (not null) in MySQL column.
In this case, root = Category,find_by_parent_id(nil) returns empty set. Changing to "parent_id: null" solves issue.

Anonymous  Mar 06, 2012 
Printed Page 51
example code

As I expected (see my comment for page 49) acts_as_tree is not recognized as a valid method.

>> root = Category.find_by_name "All"
NameError: undefined local variable or method `acts_as_tree' for #<Class:0x18dd1b8>

I am using:
[Macbook:~] irwin% ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
[Macbook:~] irwin% rails -v
Rails 2.3.5

Irwin Friedman  Mar 03, 2011 
Printed Page 55
fourth paragraph

I continue to encounter errors indicating that the prescribed method doesn't exist. in this case it's scaffold. I was able to create the Photos -- by convention, shouldn't that be a singular? -- but encountered the following when trying to view the page in my browser. BTW: I had to add: map.connect '/photos' , :controller => 'Photos', :action => 'get' to the routes.rb file in order for the browser to find the page in the first place.

NoMethodError in PhotosController#get

undefined method `scaffold' for PhotosController:Class
RAILS_ROOT: /Users/irwin/Documents/INF_Programs/ruby_development/photos

Since I don't see any similar comments in the errata for this book, I have to assume I'm missing something in my Rails configuration (version 2.3.5). I don't really want to update to version 3 unless I must. I have used other tutorials for Rails and have not had any difficulty similar to the ones I've identified. I'm afraid I'll have to not use this text further.

irwin Friedman  Mar 03, 2011 
Printed Page 105
second code block

<%= drop_receiving_element('slideshow-photo-picker',...

must be

<%= drop_receiving_element('slideshow-photos',...

(tested with Rails 2.3.4)

All draggables will else freeze and leave the developer to wonder what is wrong for a long time.

Anonymous  Oct 18, 2009