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 B1.3, released about 1 month 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
all

#32266: The view pages are currently listed as rhtml and the demo code has all rhtml pages. The new Rails 2 convention is .html.erb
--Joel Saltzman

B1.2
2
#32235: In the PDF you say "To determine the version of Rails that you are running, you can issue rails -v at a command prompt." I'm using Ubuntu L...more...
B1.2
18
#32613: Hi, As I really don’t know the answer to this question, I am not certain how relevant or desireable this would be but I would like to see a...more...
B1.3
20

#32239: I think in the section "David says..." there should be an "s" after "particular aspect".--Jannik Schürg

B1.2
33

#32114: The windows installer comes with MySQL while the book now uses SQLite. Do installment of SQLite on Windows need to be discussed further?--Trond Lossius

B1.1
34

#31989: What about pagination plug-ins?

B1.0
35
#32007: Add the Rails version into the install command: "sudo gem install -v=2.0.2 rails" Using just "sudo gem install rails" will install a newer r...more...
B1.1
35

#32289: 3.3 Installing on Mac OS X
<snip />
Leopard, but not to difficult either way.

not to -> not too

B1.3
37

#31765: 'Version Control' section talks about subversion. Rails core has moved to git, so maybe git could be more prominent in the book?--Charlie O'Keefe

B1.0
38

#32029: Maybe you should also mention XCode on Leopard--Michel

B1.1
41
#32163: You may want to mention that to install SQLite as a RubyGem in Windows, not only must you use the 'gem' command, but you must also manually do...more...
B1.1
48
#32023: I also got the above - When I run it: "Routing Error No route matches "/say/hello" with {:method=>:get}" I had to restart mongrel to get th...more...
B1.1
48

#32164: Footnote #5 at the end of page 48 appears to have been cut short. It ends without completing the sentence.--Lee Edwards

B1.1
50
#31962: I am running Rails 2.0.2 on Debian Etch. When trying to code the 'Hello Rails!' demo in the B1 version of the book, adding files like 'hello.h...more...
B1.0
52
#32243: Nothing major, never-the-less still an error. Better to correct it now. Hypothetical template time result and browser time result don't mat...more...
B1.2
55
#32165: You may want to be less flippant when answering how the view gets the time in the "Joe Asks" box. Rather than saying "magic" (hence making rea...more...
B1.1
57

#32560: #5 "substituting in values"

The "in" is redundant. Recommend using "substituting values."

B1.3
70
#31903: Could you also mention socket connections? Typical Mac OS X dev platform for many users is MAMP, which uses sockets instead of host. Maybe thi...more...
B1.0
71
#32371: Creating a new rails application with a specific database, the syntax is --database=TYPE (i.e. it needs an = between --database and the type)....more...
B1.3
74
#31817: The command, toward the bottom of the page: ruby script/generate scaffold product \ > title:string description:string image_url:string ...more...
B1.0
74
#31705: The footnote at the bottom of page 74 does not seem to operate this way. backslash does not prompt for more input C:\learn\depot>ruby scri...more...
B1.0
75
#31782: aside #7 text blurb at the bottom of the page is cut off for me: "If you then edit that existing migration file and run db:migrate again, Rai...more...
B1.0
76
#31948: The web server output has the following line: "[2008-03-27 11:54:55] INFO WEBrick::HTTPServer#start: pid=6200 port=3000" The first part of the...more...
B1.0
77

#32338: line 3: in schema.rb there is no table schema_migrations, nevertheless the database has such a table, which contains the timestamp--peter kupec

B1.3
77
#32361: How does Rake know which migrations have and have not been applied to your database? Have a look at your schema after running a migration. Y...more...
B1.3
77

#32400: in footnote #7 on page 77, you refer to the migrations table as "schema_mirations" instead of "schema_migrations"--Mark

B1.3
77

#32441: In the third sentence of the page, there's a missing character: "You’ll find a
table called schema_mirations that it uses..."

--John Chandler

B1.3
77
#32447: Well, now I paid to be a beta tester... this command sqlite3 db/development.sqlite3 "select version from schema_migrations" does not wor...more...
B1.3
78
#32186: I have been working through the book and got to page 85 when I noticed that the :scale => 2 argument doesn't seem to be working. I can enter p...more...
B1.1
78

#32207: "Listing products" image has Price column, but we haven't added it yet to the application at this point in the book.--Kai Sung

B1.2
79

#32402: This line
create db/migrate/20080601000002_add_price_to_product.rb
should not have .db at the end.--Ron Green

B1.3
79

#32173: If HTML is to be allowed in the description field, then the h method should not be used in the index.html.erb file.--Michael Gordon

B1.1
80

#32542: After the db:migration, there are 4 files to edit not 3

The additions for new.html.erb look wrong - not consistent with others (no <b> in others)--Tim Hubbard

B1.3
80
#32305: In the example we explicitly add ":scale => 2" to store prices with two digits after the decimal. I am following along using sqlite3 as the ba...more...
B1.3
80

#32582: you have to edit three files

should read

you have to edit four files
--Michael Rogers

B1.3
80
#32403: I would like a better explanation of the version number in the database. I can see that part of the version number is the date but the rest is...more...
B1.3
80

#32434: While this does mean that you have to edit three files, the
changes are very straightforward

should read four files rather than 3--James West

B1.3
81

#32182: While editing the edit.erb page, the f.label :name syntax is used rather than hardcoding the labels (as shown in the example).--Rick

B1.1
82
#32304: It is not clear why, in the addition to new.html.erb, the "Price" label is added using literal HTML, whereas in the already existing template ...more...
B1.3
82
#32172: In the app/views/products/show.html.erb module, you have used the h method to strip HTML escape chars as follows: <p> <b>Description:</b> ...more...
B1.1
83
#31999: Maybe I'm slow, but last paragraph talks about "Product model class" and where the method should be placed. I think at this stage you should s...more...
B1.1
84
#32583: When you start talking about validates_presence_of, it would be nice, in the margin, to remind the reader that this is an example of a declara...more...
B1.3
87
#31911: "Note also that, because it uses Rails’ create method, it will fail silently if records cannot be inserted due to validation errors." -> This ...more...
B1.0
87

#31952: In the self.up method, the text "foundational piece of any project's" appears to be italic, which would be odd as this is part of the code listing.--Dave Roberts

B1.0
87
#32498: This paragraph on page 109 would go better here so to warn developers of the effects of writing code below the "protected" line. From page ...more...
B1.3
89
#32577: The migration code contained this assignment to image_url: :image_url => '/images/svn.jpg' , when I run the example, the generated html ...more...
B1.3
90
#32249: Just to clean up the HTML a bit, and separate presentation from content a little better, instead of <table cellpadding="5" cellspacing="0"...more...
B1.2
91
#32180: The screenshot shows the header "Product Listing", while the source code shown produces a screenshot the has a heading of "Listing Products". ...more...
B1.1
92
#32341: The second full bullet on this page reads "We also used the h method to ensure that any remaining the HTML in the product title and descriptio...more...
B1.3
92

#32208: The "Listing products" image shouldn't contain HTML markup in the description since we removed it using product.description.gsub(/<.*?>/,'').--Kai Sung

B1.2
96
#32420: after adding the storecontroller, i received an error "No route matches "/login/index" with {:method=>:get}". restarting mongrel cleared t...more...
B1.3
98

#31916: The background colour of logo.png doesn't match the css colour of the header. In the screenshot it looks like it should. Trivial, I know :)--Antony Blakey

B1.0
98
#31953: The CSS provided doesn't make the page look much like the picture - the background on the sidebar doesn't extend properly, the icons for the b...more...
B1.0
101

#31806: Doesn't the recommendation of using the link_to for the image link go against everything else that was mentioned earlier? Second bullet in playtime.--Shaun McDonald

B1.0
102

#32395: Suggest you describe why using :id => product is okay as the ":id" of the item, as opposed to :id => product.id.--William Nace

B1.3
102
#32484: I like the yellow arrows showing what new code to add to previous code. I think it should belong on page 102 to illustrate to the reader to ad...more...
B1.3
103
#32396: "return salable items." is poor wording choice, as in the real world, returns happen when we don't like an item and take it back. Since you ...more...
B1.3
105
#31714: The statement on pg 105 "The next time you restart your application (stopping and starting script/server), it will store its session data i...more...
B1.0
107
#32497: To quote Chuck Hinson: "#31714: The statement on pg 105 'The next time you restart your application (stopping and starting script/server...more...
B1.3
109
#31950: Call me picky, but the cart title is an h1 while we already have an h1 on the page in the header ("Pragmatic Bookshelf"). You change the cart...more...
B1.0
110
#32326: Footnote 2 states that ":id=>product is idiomatic shorthand for :id=>product.id". It is *very* helpful that you point this out, and it would ...more...
B1.3
110
#31958: It's possible to get a rather hard to find error if you leave off the parenthesis on the else clause in add_product (@items << CartItem.new(pr...more...
B1.0
110
#31960: I got a 'uninitialized constant Cart::CartItem)' error, which took me quite a while to figure out. It was obviously a class loading problem, b...more...
B1.0
111
#32093: When I got to the line: >rake db:sessions:clear I had to hit cntrl-c first to stop the server which made me wonder if stopping the serve...more...
B1.1
111

#32450: protect_from_forgery :only => [:create, :update, :destroy]

Should sort it. Books needs to mention this.--Adam Craven

B1.3
112
#31949: While I understand why you chose to build the cart with sessions to illustrate a point, I think it would be helpful to show a counter example ...more...
B1.0
115

#32080: when i put //localhost:3000/store/add_to_cart/wibble in the browser nothing is returned
i'm sinply back to //localhost:3000/store/--michel

B1.1
117
#31998: Found a browser related bug! The CSS for #notice works fine in Firefox (I get a red border around the error message the same as in the screens...more...
B1.1
122
#32290: The function for cart.total_price is incorrect, because it doesn't take quantity into account. It should be: def total_price @items.sum { |...more...
B1.3
131

#32279: "An .js.rjs template is a way of getting JavaScript on the browser to do what you want": "An" should be "A"--Brent Nordquist

B1.3
131
#32339: I get an error in the application log saying rails is looking for add_to_cart.js.erb instead of add_to_cart.js.rjs. As a result the cart is no...more...
B1.3
131
#32421: "respond_to { |format| format.js }" I saw this line of code and had trouble understanding why "format.js" and not "add_to_cart.js". Only af...more...
B1.3
133
#32327: The server in the URL in footnote 4 (wiki.script.aculo.us) does not resolve... $ host wiki.script.aculo.us Host wiki.script.aculo.us not fou...more...
B1.3
136
#32157: We've seen a lot of hashes where a :symbol is used as a key, but here we see attributes["style"], where the key is a string. Perhaps some expl...more...
B1.1
136
#32432: You say : A better way to handle the problem is to create the cart HTML but set the CSS style to display: none if the cart is empty. To do ...more...
B1.3
136
#32204: I've reviewed the code a couple times, and attempted both the simple fix and the better fix for removing the flickering upon adding an entry t...more...
B1.2
137

#32320: In the sentence that begins "The Rails generators automatically...", the word "produts" should be "products".--Tanabe

B1.3
137

#32158: I'm not 100 percent sure but wouldn't the title "Downgrading If Javascript is Disabled" be more appropriate?--David

B1.1
141

#31963: You dont need DDL code. I guess that plugin (references) is in core now, use:
t.references :product; t.references :order--Marcos Augusto

B1.0
145
#32311: The top of this page shows code : class LineItem < ActiveRecord::Base belongs_to :order belongs_to :product def self.from_cart_item(cart...more...
B1.3
145
#32251: The version of _cart.html.erb shown on this page does not have Ajax for the "empty cart" button, where as most users following the example wou...more...
B1.2
146
#32280: "<%= button_to "Checkout", :action => :checkout %>": Put a "this line changed" triangle in front of this line, to show the reader which line t...more...
B1.3
147

#32362: Is there are reason you abandoned the form_remote_tag previously used for the empty_cart action?--David Schwartz

B1.3
150
#32178: Twelfth line from bottom: "...each new line item to the line_items collection on line hands the responsibility..." => missing line number? ("...more...
B1.1
153
#32312: Running the SQLite3 SQL depot> sqlite3 -line db/development.sqlite3 SQLite version 3.4.0 Enter ".help" for instructions sqlite> select *...more...
B1.3
153
#32313: UPDATE: I see the timestamps updated_at and created_at are actually created by the application (and thus those fields are in our table as well...more...
B1.3
155
#32230: What happens if you are on the place order screen and click empty-cart? Should a user be able to order an empty cart? Implement a re-direct to...more...
B1.2
160
#32470: On this page, for the first time, we see the following code: self.salt = self.object_id.to_s + rand.to_s With this explanation: "Without...more...
B1.3
164
#32193: In reference to the comment above #32110, it looks like there is no login.html.erb file in the views/layouts directory to handle putting the C...more...
B1.2
164

#31985: I believe that the fieldset and legend tags should be inside the form tags. --Zach Langley

B1.0
166

#32295: the code for the login index view is incorrect, it is showing the code for the products index

B1.3
166
#32225: Seventeenth line from bottom: "flash.now[:notice] = ..." => An explanation of "flash.now" as well as why it is used rather than just "flash" ...more...
B1.2
168

#31835: This page seems to be the first mention of the admin_controller, even so it is a one line snippet.--Sh

B1.0
172

#32281: "We have just limited access to the store iteself to administrators.": "iteself" should be "itself"--Brent Nordquist

B1.3
172
#32346: [sorry; should have posted this here first. I posted it over in the forums section before realizing there was a separate errata system. No n...more...
B1.2
173
#32324: >redirect_to(:controller => "login" , :action => "login" ) I think this should be redirect_to(:controller => "admin" , :action => "login...more...
B1.3
173
#32220: Sixth line from top: ... link_to 'Orders', :controller => 'orders' ... => I don't recall an 'orders' controller being generated earlier (only...more...
B1.2
174

#32337: Should add "changes this" arrows to the <% if @cart @> .. <% end %> addition as well...--Marcus Bertrand

B1.3
177

#32380: I think there is a typo in the third line of new code for the "destroy" method:

#{user.name}

should be:

#{@user.name}--Dan Steinicke

B1.3
185
#32385: You have the default template generated as well as the one that you create in the suggested code snippet. Note the two lines marked with >> as...more...
B1.3
186
#32285: "Now we’ll use respond_to to vector to the correct template" ... ":xml => @product.to_xml(:include => :orders)": By including this ":xml => @p...more...
B1.3
187
#31840: I have the following in the product_test.rb file: require File.dirname(__FILE__) + '/../test_helper' class ProductTest < ActiveSupport::...more...
B1.0
187
#32386: In the def for who_bought you've changed the respond_to from |format| 2 pages prior to |accepts| without any changes as far as I can tell. If ...more...
B1.3
187
#32466: You state in the line below the heading "Autogenerating the XML" that in previous examples we used the template to create the XML. However, in...more...
B1.3
189

#32126: My generated unit test does not include the fixtures :products line.--Brad M.

B1.1
194
#32612: When my version of Rails 2.1.0 (installed from RubyGems) automatically creates test files, the first line reads: require 'test_helper' ...more...
B1.3
194
#32388: The product_test.rb generated automatically does not contain the fixtures :products as indicated on this page. This is using rails 2.1.0. ...more...
B1.3
195
#32389: Why the switch to mysql from sqlite3? The depot application has been using sqlite3 and it doesn't quite seem consistent (or necessary) to swit...more...
B1.3
200
#31750: Generated functional tests of rails 2.0.2 aren't subclass of Test::Unit::TestCase, but ActionController::TestCase. I suppose the book should ...more...
B1.0
206
#32390: We never created a LoginController... we created an Admin Controller with the methods: login, logout and index. Also, the automatic admin_c...more...
B1.3
208
#32391: You seem to have pasted the code twice for the ApplicationController separated by a single line... it doesn't really make sense. It starts on ...more...
B1.3
218
#31848: There is no mention about the creation of depot_r/test/integration/dsl_user_stories_test.rb It would be nice if there was, even if it was only...more...
B1.0
226
#32615: In the function test_two_people_buying, the function check_for_order is used, but it is neither explained nor defined anywhere until page 688 ...more...
B1.3
230
#32534: The listing of the dynamic fixture 'test/fixtures/performance/products.yml' appears to be incorrect. The lead in to the listing reads 'To c...more...
B1.3
232

#32008: Rest if a pun, right? "This chapter sets the scene. It talks about all the high-level stuff you need
to know to understand the rest:"--Ray Daly

B1.1
240
#32372: Instructions created a Rake task in lib/task named db_schema_migrations.rake and then demonstrate running it with the command "rake db:schema_...more...
B1.3
244
#32296: "As well as freezing the current gem version of Rails into your application, you can also link your application to a version of Rails from R...more...
B1.3
250

#32301: The view naming table gives the name of the file to be app/views/store/list.rhtml Shouldn't it be list.html.erb?

--Adam Chester

B1.3
263

#32404: rake db:migrate not ruby db:migrate
--Dave Tolsma

B1.3
283
#32387: When authoring a migration for the purpose of "creating data that’s a convenience for the developer when they play with the application", it s...more...
B1.3
285
#32288: "Be warned: the only data you should load in migrations is data that you’ll also want to see in production: lookup tables, predefined users, an...more...
B1.3
285
#32293: "Be warned: the only data you should load in migrations is data that you’ll also want to see in production: lookup tables, predefined users, an...more...
B1.3
298
#32427: Substitue "class Book" with "class BadBook" The code says "class Book < ActivieRecord::Base self.primary_key = "isbn" end" The next...more...
B1.3
334
#32413: The word "divine" in this sentence should be "define"? "...we can see why it’s hard for Active Record to divine the relationships between t...more...
B1.3
335
#32406: The illustrations for the One-to-One and One-to-Many relationships are correct, but the readability could be tweaked. I tend to read from l...more...
B1.3
351
#32349: "Note that it isn’t possible to set attributes in the intermediate table using this approach." This leaves a huge gap. So how do you set the...more...
B1.3
360
#32551: The previous page states that we "clear out our database"; then we create three assets. Yet, when we query the catalog_entries table, we find ...more...
B1.3
364

#32317: The example used for create table may be updated to Rails 2 syntax. (t.integer instead of t.column)--Ozum Eldogan

B1.3
375

#32409: in validates_inclusion_of, at options, :allow_nil appears twice. i think that the second is allow_blank--netrider@tutopia.com

B1.2
390

#32332: From the page:
"For example,on page
385 we created a callback that generated a log message..."

The example is on page 386--Ozum Eldogan

B1.3
406

#32342: ActionController::Routing::Routes is nil for me. Is there another step to initialize it?--Gordon Booman

B1.3
410

#32013: Under Controller Naming (or Named Routes above), I'd also like to see a quick example showing a named route using a moduled controller.--Ashley Thomas

B1.1
410
#32344: I would have been helped by a sentence or two about routing to the root directory of a [sub]domain - e.g. map.connect "/", :controller => ...more...
B1.3
454
#32354: In the paragraph starting with "As is usual with Rails..." it is written "... added to to-level application controller..." instead of "top-lev...more...
B1.3
481

#32321: In the sentence that begins "Our Depot application, for instance", the word "produts" should be "products".--Tanabe

B1.3
481
#32398: Pagination as described in the section "Pagination Helpers" was deprecated and removed from Rails as of 2.0 (as per wiki.rubyonrails.org). The...more...
B1.3
494

#32410: This section talks about pagination helpers and how they may be split off in Rails 2.0. Rails 2 is here and pagination is gone.
--Otto Hammersmith

B1.3
567

#32426: missing: code truncated--Christine Albrecht

B1.3
571

#32568: in place editing has been moved to a plugin.
--Christine Albrecht

B1.3
659
#31880: NoMethodError (undefined method `paginate' for #<AdminController with: @product_pages, @products = paginate :products, :per_page => 10 or:...more...
B1.0