We try to keep our books accurate, but sometimes mistakes creep in. This page lists the errors submitted by our astute readers. If you've found a new error, please submit it.

The latest version of the book is P6.0, released over 2 years ago. If you've bought a PDF of the book and would like to upgrade it to this version (for free), visit your home page.

Key: Typo Tech. Error Suggestion Not a problem Next edition

By default this page displays the errata for the latest version of the book. If you have a previous version, select it here:  

(To find out what version you have, look at the copyright page, a few pages in from the front of the book. If it says (say) 'Second Printing', then here it'll be P2.0. If there are interim PDF releases in that printing, they'll be 2.1, 2.2, and so on.)

PDF Paper Description Found in Fixed in
i i
#23216: Dave says: For general help with Rails and examples in the book, I recommend the Rails mailing list at http://lists.rubyonrails.org/mailman/li...more...
P2.0
25-Aug-05
1
#24344: You should put together a comprehensive list of all the naming conventions in one place. "id" is in the begining of the book, datetime on pag...more...
P4.0
21-Mar-06
5
#24234: Currently, all downloadable code linked from the PDF book has the Content-Type set to "text/html". This will make most browsers show the code ...more...
P4.0
03-Mar-06
5

#24514: "In the margin, you--jeff e

P4.0
21-Apr-06
6
#24088: "This book documents Rails V1.0, which became available in mid 2005" should be "This book documents Rails 1.0, which became available on Decem...more...
P4.0
08-Feb-06
15
#24522: "Sometimes these class-level methods return collections of objects. Order.find(:all, :conditions => "name='dave'") do |order|  puts order.a...more...
P4.0
23-Apr-06
20
#25308: Well one drop for the general context... I must confess I haven't bought that book yet, I'm just testing it. It's my first contact with Rails...more...
P4.0
21-Jun-06
23

#25285: In the fifth printing of the book, the link to Lucas Carlson's instructions for Ruby on Mac OS X Tiger leads to an error page.--Jeffrey Yu

P4.0
17-Jun-06
33
#24403: The "Making Development Easier" box is very valuable information, but I question whether this is the best place to put it. I would have rathe...more...
P4.0
03-Apr-06
50
#24405: I am going through the tutorial with you: After "rails depot" and then "cd depot" and then "ls" my directories are different from yours. For ...more...
P4.0
03-Apr-06
50
#24533: The code at the bottom of the page is unclear. What should one do with it? Type it at an 'mysql' prompt? If so, the result is an error (104...more...
P4.0
26-Apr-06
50
#25309: I'm using MYSQL 5.0.22 the current last stable version on windows XP SP2. It's my first enccounter with MYSQL so my problems could be related ...more...
P4.0
21-Jun-06
51

#23994: you might want to add "-u dave" to the mysql statement--Chad Bearden

P4.0
26-Jan-06
51

#24534: When one types the following string (mysql depot_development <db/create.sql), the result is an ->. What then? This entire section is unclear.

P4.0
26-Apr-06
52
#24116: It seems that the rails script now adds the application to database.yml: database: depot_development It automatically replaces the rails...more...
P4.0
12-Feb-06
52
#24409: Not sure if you mention this later or not, but for Windows there needs to be: port: 3306 in the file. And for Linux there needs to be, ...more...
P4.0
04-Apr-06
52
#25310: Depot_xxxx are already correctly set in database.yml. But as you said after, I advise to put 'dave' as username in development and test. The ...more...
P4.0
21-Jun-06
53
#24500: Repeated reinstallations of entire package on OSX 10.4.6 continually produce the following: ./script/../config/../config/environment.rb:8: ...more...
P4.0
19-Apr-06
53
#24510: for, depot> ruby script/generate scaffold Product Admin I had to use infor from http://dev.rubyonrails.org/ticket/200 to get it to work...more...
P4.0
21-Apr-06
53
#24532: When attempting to run the line "ruby script/generate scaffold Products Admin" in Windows, I receive the following error listed in the book (a...more...
P4.0
26-Apr-06
53
#24556: On OS X (10.4.3), when I attempt to run script/generate scaffold Product Admin, I get the following error: You have a nil object when you d...more...
P4.0
30-Apr-06
54
#24212: While creating the databases, the user should issue the command: mysql> grant all on depot_development.* to 'dave'@'localhost'; There is n...more...
P4.0
28-Feb-06
54
#24283: After setting database privileges, if you exit mysql without typing the magic words "flush privileges", the privileges you've just set won't t...more...
P4.0
11-Mar-06
57
#26704: ppc:~/work/depot tomcoady$ ruby script/generate scaffold Product Admin ./script/../config/boot.rb:18:in `require': No such file to load -- ru...more...
P1.0
03-Dec-06
57

#26705: Solution to my tech error:
ppc:~/src/rubygems-0.8.11 tomcoady$ sudo ruby setup.rb
ppc:~/work/depot tomcoady$ sudo gem install -v=1.1.6 rails
--Tom Coady

P1.0
03-Dec-06
57
#25428: After running "ruby script/generate scaffold Product Admin" on linux box using SuSE v10.0 and MySql Ver 14.12 Distrib 5.0.22, I get an error s...more...
P4.0
09-Jul-06
57
#23940: The 'gotcha' notes (3,4,& 5) are useful. You might consider adding another... If you get Routing Error: Recognition failed for '/admin', ...more...
P3.0
12-Jan-06
57
#26760: I think the code should read ruby script/generate scaffold Products Admin since the table was created with the name products (plural, not ...more...
P6.0
16-Dec-06
57
#31649: My version of the paper book is actually P5 (2006-02-16). The problem is that scaffold has changed. I am running Rails 2.02 and the following ...more...
P4.0
11-Apr-08
57
#26821: Okay, so this is a gripe. As noted previously, the link to Lucas Carlson's fix is no longer to be found as described. However, you can go to t...more...
P6.0
09-Jan-07
57
#24784: I've seen this error elsewhere but never a solution. Here goes: On page 57, I entered, at depot prompt, ruby script/generate scaffold Produc...more...
P4.0
08-May-06
62
#24333: The unless clause of the validate method is wrong. To verify this, comment out 'validates_numericality_of :price' and try submitting a produc...more...
P4.0
19-Mar-06
62
#25300: In the eBook we have this code for product.rb: errors.add(:price, "should be positive") unless price.nil? || price >= 0.01 Where as the down...more...
P4.0
21-Jun-06
62

#25301: Quote from second paragraph:
"Note that we only do the check if the price has
been set. Without that extra test we--Max

P4.0
21-Jun-06
62
#29155: Just a note for readers who may get put-off by the unknowability's of generated code-bases early on. Should a user make an error in pluralisa...more...
P6.0
28-May-07
63 63
#24557: Cannot "destroy" items. Both file listings 66 & 67 omit ':post' argument in the link_to 'Destroy' line. The line should read: <%= link_t...more...
P4.0
30-Apr-06
64

#24397: Link to ERb definition is not on page 31 as stated.--Pierre-Loïc Raynaud

P4.0
01-Apr-06
64
#25764: It took me quite some time when I was working through the sample code to figure out what was wrong. When editing the list.rhtml, I just erase...more...
P6.0
21-Aug-06
65

#25475: ITERATION A4

P4.0
18-Jul-06
65
#24254: Relative URL's not allowed by current validates_format_of :with parameter; where the text says: "Put some images in the public/images director...more...
P4.0
08-Mar-06
65

#25311: ":post => true" is missing after :confirm => "are you sure?".
Without this you cannot destroy anything :)

Feedback to Kagejin0@yahoo.fr --Koguma

P4.0
21-Jun-06
69
#25734: The list action for Destroy as it is in the book didn't work for me: Clicking Destroy would pop up the confirmation dialog, but choosing ok wo...more...
P6.0
17-Aug-06
69
#24228: The text starting: 'put some images in the public/images directory' led me to think that the correct url for the images in the production form...more...
P4.0
03-Mar-06
69
#24313: The images do not display when added in relative format. In the list.rhtml file you should use <img width="100" height="80" src="/depot/ima...more...
P4.0
17-Mar-06
71

#24420: We’ll also take this opportunity to tidy up the index.rhtml view in app/views.

it should be: app/views/store--kibo

P4.0
07-Apr-06
71
#23965: This is the first time depot.css is mentioned. It has to be included in the project for proper view display. Needs to be copied from the sam...more...
P4.0
18-Jan-06
71

#26291: I'd rather remove the line numbers from listing of layout store.rhtml. With line numbers this sample is uncomfortable to copy/paste.

P6.0
18-Oct-06
73
#26711: The suggested code does not work for me but I found the right code elsewhere in the code bundle - detail here to avoid unititiated Product: ht...more...
P1.0
04-Dec-06
76
#24091: As was previously stated, " In the implementaion of find_cart, the 3rd line reads "session[:cart] ||=Cart.new" This line should read "@cart = ...more...
P4.0
09-Feb-06
76

#24888: At first sight this approach to database maintenance is
attractive--Gordon Thiesfeld

P4.0
17-May-06
76
#25164: As pointed out before, there is an error in session[:cart] ||= Cart.new I replaced the code with session[@cart] ||= Cart.new and it magi...more...
P4.0
03-Jun-06
79

#23187: The hyperlink to page 474 that describes the << operator points to page 473.--Stephen Touset

P2.0
20-Aug-05
80
#25862: I made all the additions to the code to the end of making the cart I get the rails error: "You have a nil object when you didn't expect...more...
P6.0
07-Sep-06
81
#24329: IWhen I run the sql at the bottom of the page to create the new table, I get an error "ERROR 1005 at line 13: Can't create table '.\depot_deve...more...
P3.1
18-Mar-06
81
#25904: similar to the error already reported... ERROR 1064 (42000) at line 12: You have an error in your SQL syntax; check the manual that corresp...more...
P1.0
12-Sep-06
81

#25318: items.sizes is nil !!!

P4.0
22-Jun-06
82
#24395: Others have mentioned this error and I've tried all their suggestions but I can't get any to work. Upon testing the cart to see if it will ret...more...
P4.0
31-Mar-06
83
#24335: find: Using the model declaration forces Rails to load the user model class early, replace with: Using the model declaration forces Rails...more...
P4.0
20-Mar-06
84
#24393: The online version of the file for '...app/models/cart.rb' (http://media.pragprog.com/titles/rails/code/depot9/app/models/cart.rb) differs in ...more...
P4.0
30-Mar-06
85
#23910: The display_cart method on this page must be placed in the store controller *before* the private declaration line that's already in that class...more...
P3.1
02-Jan-06
85
#24422: In reference to problem #2532, "You have a nil object when you didn't expect it!", I also ran into the problem in chapter 8. I typoed a simpl...more...
P2.0
07-Apr-06
85
#26229: When looking at "depot/public/store/display_cart" with my browser I was getting the error: undefined local variable or method `find_cart' f...more...
P3.0
12-Oct-06
85
#24256: Re #2532 - This also happend to me running under Webrick. The solution was to both close the browser and restart Webrick. Hope this helps th...more...
P1.0
09-Mar-06
86
#29669: Concerning the invalid IDs of objects in the URL line: it is not certain that an exception will always be thrown. I assume that the ID field, ...more...
P1.0
16-Sep-07
87
#24448: In regard to the common error "NoMethodError in Store#display_cart Showing app/views/store/display_cart.rhtml where line #5 raised: You...more...
P4.0
12-Apr-06
88

#24296: Editing cart.rb in order to enable the quantity to increment requires a WebTrick restart to work properly.--Bob Clewell

P2.0
15-Mar-06
90
#24288: The file link beside "<% @page_title = "Your Pragmatic Cart" -%>" is File 29. File 29 contains the fmt_dollars() helper. fmt_dollars() isn't d...more...
P4.0
13-Mar-06
96
#24860: Unable to create the session table. C:\apps\ruby\files\work\depot>rake --trace db:session:create (in C:/apps/ruby/files/work/depot) rake ...more...
P4.0
15-May-06
96
#25138: Flash messages are not displaying correctly using IE 6 sp2. Results of invalid add_to_cart, empty_cart, etc no flash message appears to dis...more...
P3.0
31-May-06
98
#23580: using the fmt_dollars(item.unit_price) method, values less than 1, (values < 1) on the display_cart details show up as 0.00 but get added corr...more...
P2.0
22-Nov-05
98

#24003: render_partial "form"
is now
render :partial => "form"--Dave Myron

P4.0
31-Jan-06
99

#25348: In "Putting Session in the Database", theres an extra "that." in the first paragraph (First, we--Jose Guerra

P4.0
27-Jun-06
99
#24239: Since file names can contain dashes (-) in them, it never struck me that check-out.rhtml was actually checkout.rhtml until I went to test the ...more...
P4.0
06-Mar-06
101
#26216: @order.line_items << @cart.items has to be @order.LineItems << @cart.items otherwise, ruby will report an unknown method "line_items" for the ...more...
B1.0
10-Oct-06
103

#26369: 103 describes nirvana as a state of being, but it is really a state of not-being.--William Henderson

P6.0
24-Oct-06
103

#25340: Not filling the 4 fields is will highlight them correctly, but there is no message as shown on the screen copy.--koguma

P4.0
26-Jun-06
105
#23872: When I write code as in file 36: options = [["select a payment option", ""]] + Order::PAYMENT_TYPES select( "order", "pay_type", options) ...more...
P3.0
21-Dec-05
105
#24216: The file name checkout.rhtml is hyphenated to check-out.rhtm in paragraph 3. This is the only reference to the file name on the page where the...more...
P4.0
28-Feb-06
108
#24213: The code in checkout.rhtml that displays the error message is given as: <%= error_messages_for(:order) %> This works fine if there is an...more...
P4.0
28-Feb-06
108
#24215: The problem with "error_message_for(:order)" occurs if you have named the page check-out.rhtml as given on page 105. If you correct the page n...more...
P4.0
28-Feb-06
109
#23894: Adding the scaffold stylesheet to the store layout seems to disable any formatting from the depot stylesheet. It doesn't seem to matter which...more...
P4.0
30-Dec-05
109
#24473: #2855: The test "Just as with the administration validation, we need to add the scaffold.css styolesheet to our store layout file to get decen...more...
P4.0
13-Apr-06
109
#24289: There is an issue with the cascading style sheets being used here. The problem is that both the scaffold and depot stylesheets are combining t...more...
P2.0
13-Mar-06
115

#24141: "and a slightly different interaction style to the one we've been using so far." -> "... interaction style than the one we've been using so far."--Justin Johnson

P2.0
16-Feb-06
116
#26928: This may be a simple erratum. In the 7th row of the code, where in the function of ship, the "#{count_text} marked as shipped" should be "has ...more...
P6.0
01-Feb-07
116
#23947: The code given for the ship method should not include the check (if count > 0) if you want to be able to show the intended message "No orders ...more...
P4.0
16-Jan-06
119

#24334: The admin.css file is not included in the code download, so we need to type this in manually :(--Nick Coyne

P3.1
19-Mar-06
119
#24472: The test "Just as with the administration validation, we need to add the scaffold.css styolesheet to our store layout file to get decent forma...more...
P4.0
13-Apr-06
120
#24162: The code snippet given for login_controller.rb is missing an "end" statement at the end of it to close : class LoginController < Applicatio...more...
P4.0
21-Feb-06
122
#26252: The ship method only calls the pluralize method if the count is greater than 1: def ship count = 0 if things_to_ship = params[:to...more...
P3.0
14-Oct-06
122

#24217: The Login controller's "Add User" picture is incorrect. It has the stylesheet applied and looks much fancier.--Miles K. Forrest

P4.0
28-Feb-06
122

#24518: in File 48 (listed on page 122) -- the Pluralize method returns an error of 'undefined method' for 'pluralize'

P4.0
22-Apr-06
126
#22678: "Have a look at the source of the controller on page 478 and of the view on page 486." The link to page 478 goes to page 475, and the link ...more...
B1.0
04-Jun-05
126

#24218: Link to page 490 actually goes to 487, and 498 goes to 495--Miles K. Forrest

P4.0
28-Feb-06
130

#26190: Whenever I try to add the initial user I am just forwarded to login/login. Is there another way just to add 1 user?--Sean

P6.0
08-Oct-06
134
#24131: The delete_user action uses a symbol reference for the redirection: redirect_to(:action => :list_users) While this obviously works it is a l...more...
P3.0
14-Feb-06
134
#24004: It seems that the generator for unit tests no longer generates the setup method (Rails 1.0.0) so the code in the PDF/Book doesn't match watch ...more...
P4.0
31-Jan-06
138
#24246: the "assert_equal 29.95, @product.price" fails for me, even though product.price is 29.95. The only way to make this assert to pass it was ch...more...
P4.0
07-Mar-06
139
#24182: You might want to make mention of looking at the code for this test section. You tend to be very brief in your explanation and tend to leave ...more...
P4.0
22-Feb-06
140
#24315: Following the book, the create.sql creates MyISAM tables in MySQL by default. To change these later, use: ALTER TABLE depot_test.products E...more...
P4.0
17-Mar-06
141
#24340: Maybe it helps someone: here is the correct code for test_read_with_fixture_variable: def test_read_with_fixture_variable assert_kind_...more...
P4.0
21-Mar-06
141

#24444: If you are getting the error about @products being nil then set use_instantiated_fixtures = true in test/test_helper.rb.--Luca Spiller

P4.0
11-Apr-06
141 68
#23938: As a side bar it would have been nice to have been warned about strftime and how our database with empty or default 0000-00-00 00:00:00 values...more...
P1.0
11-Jan-06
141
#24295: New to RoR, so this might be the same as the erratum beginning "With the new testing rules, a good chunk ". In the test_read_with_hash method...more...
P4.0
14-Mar-06
142
#23879: Figure 12.1 suggests the members of the @products hash are Product objects coming from the database, as @version_control_book is. This is misl...more...
P3.1
24-Dec-05
143
#23850: If you make a mistake in the yaml for the entry @future_proof_book, you won't be told if it doesn't exist and it will silently pass as it reso...more...
P3.1
15-Dec-05
144

#24142: "... then paying his valid credit card..." -> "... then paying with his valid credit card ..."--Justin Johnson

P2.0
16-Feb-06
146
#24005: test_helper.rb looks (mostly) nothing like the example in the PDF. It now looks like: ENV["RAILS_ENV"] = "test" require File.expand_pat...more...
P4.0
31-Jan-06
147
#23885: test_helper.rb must be updated in order for the test_destroy method to be used if the MySQL database is using MyISAM tables (the default for C...more...
P3.0
27-Dec-05
148
#23887: Rails has recently, in 1.0, updated the way it handles fixtures. If you're having problems, see Mike Clark's weblog here: http://clarkware.co...more...
P3.0
28-Dec-05
148
#24022: The @products and @version_control_book instance variables are not available unless you set the 'use_instantiated_fixtures' attribute to true....more...
P3.0
03-Feb-06
148
#24561: when running test_read_with_hash omitting the before_type_cast suffix to the date assertion seems to allow the test to pass - including it cau...more...
P4.0
01-May-06
151
#23261: Maybe I'm not quite understanding what Mike is saying (in the context of using a dynamic fixture to 'future-proof' the test of salable_items)....more...
P1.0
27-Sep-05
152
#28629: in your tests, you are testing the equality of ambiguous numbers (floats). The prices you chose for the fixtures just _happen_ to work, but ot...more...
P3.0
19-Apr-07
156 - 159
#24080: The file examples for store_controller.rb thoughout this section contain arguments to the fixture() method that look like this. fixtures :pro...more...
P4.0
07-Feb-06
156
#24441: Book Version 2005-12-20. Running "ruby test/functional/login_controller_test.rb" produces error: "method 'before_destroy' for LoginController...more...
P4.0
11-Apr-06
159
#24197: This may be a Ruby/Rails version problem (Ruby 1.8.2, Rails 1.0.0). The session array is problematic. I see examples with it as a global var...more...
P3.0
25-Feb-06
166
#27028: The listing of application.rb is inaccurate. It should include the following lines just after the class declaration: # Pick a unique coo...more...
P4.0
23-Feb-07
169
#24297: File 121 online (http://media.pragprog.com/titles/rails/code/depot_testing/test/performance/order_test.rb) doesn't quite match the code on the...more...
P4.0
15-Mar-06
169
#24298: When running the performance test it fails with a MySQL foreign key constraint violation. Examining the test log file, it's because the first ...more...
P4.0
15-Mar-06
170

#24347: The use of transactional fixtures is already standard in my version of Rails (set in test_helper.rb).--Juergen

P4.0
21-Mar-06
170

#25446: h

P4.0
14-Jul-06
176
#24151: Running the code listed for File 121 on Page 176 of the book (12.7 Performance Testing) produced an integrity constraint violation error from ...more...
P3.0
17-Feb-06
183
#23936: Grouping controllers in modules: I have grouped controllers as described in this section using the command format: myapp> ruby script/generat...more...
P3.1
10-Jan-06
193
#25395: Logging In Now that we have a user in the test database, let's see if we can log in as taht user. If we were using a browser.... ---- ...more...
P4.0
03-Jul-06
207
#24548: Order.find_on_page(page_num, page_size) the above function defined should probably be more like, def Order.find_on_page(page_num,page_si...more...
P4.0
27-Apr-06
209
#23966: To be a little more consistent, I think the line order = Order.find_all_by_email(params['email']) should be "orders = .... " to match t...more...
P4.0
19-Jan-06
212
#23876: <blockquote><code>result = Product.update_all("price = 1.1*price", "title like '%Java%'") </code></blockquote> It would have been useful if...more...
P3.1
23-Dec-05
213 222
#23948: In the bit about save vs. save! when it comes to callbacks in there too it doesn't work exactly like that either :-( Went digging and found h...more...
P4.0
17-Jan-06
221