small medium large xlarge

Errata for Advanced Rails Recipes

 

The latest version of the book is P1.0, released over 8 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.

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

If you've found a new error, please submit it.

  • Typo
  • Tech. error
  • Suggestion
  • Maybe next edition
  • Not a problem
  • Reported in: P1.0 (02-Feb-09)
#37437
PDF page: 14

rake migrate is enough, no need to rake create before that--Reuben Sivan

  • Reported in: P1.0 (26-Jan-09)
#37296
PDF page: 18
re: puts events.map(&:name) The frequent use of the &:method_name syntax in this book warrants some explanation. As far as I can tell, the current...more...
  • Reported in: P1.0 (02-Feb-09)
#37446
PDF page: 21

I'd suggest the reader at this point to add a search.html.erb file to display the search results--Reuben Sivan

  • Reported in: P1.0 (17-May-11)
#47074
PDF page: 21
Routes syntax changed considerably in ROR 3. The eg given map.resources :events, :collection => { :search => :get } Should be <code> resource...more...
  • Reported in: P1.0 (01-Feb-09)
#37427
PDF page: 22

the method copy in this page is incomplete. The online code has it right.--Reuben Sivan

  • Reported in: P1.0 (02-Feb-09)
#37451
PDF page: 26
in registrations/index.html.erb, the following line of code: for registration in @registrations should be for registration in @event.registration...more...
  • Reported in: P1.0 (13-Aug-08)
#33955
PDF page: 32

Second to the last paragraph, last line, should probably say "as we'll see in *a* minute"

  • Reported in: P1.0 (18-May-11)
#47076
PDF page: 44

Download CatchAll404s/app/models/four_oh_four.rb

find_or_initialize
in code provided

find_and_initialize
in code description--Vlad Ivanovic

  • Reported in: B1.06 (05-Dec-09)
#41710
Paper page: 50
On the bottom of page 50, it says, "we can mix in our custom validation methods only when we need them." I don't understand. They're always mixed in...more...
  • Reported in: P1.0 (31-Jul-08)
#33413
PDF page: 70
The exisiting_task_attributes POST parameter example shows the hash of the existing task as and array of hashes. I think it is actually just a hash. ...more...
  • Reported in: P1.0 (27-Aug-09)
#40573
Paper page: 72
In the first code example, it shows that "existing_task_attributes" references an array of hashes. I think it just references a hash, and the prose s...more...
  • Reported in: P1.0 (14-Jul-08)
#33044
PDF page: 73

The recipe is formatted differently from the others (has no "problem", "ingredients", "solution", etc. tabs). This looks messy--vzakharov@gmail.com

  • Reported in: P1.0 (02-May-08)
#31852
PDF page: 73
Hi, there's a delete of a task from inside an iterator. I don't think that's safe, you'll not get to the end of the collection there. I had a collecti...more...
  • Reported in: P1.0 (06-Jun-10)
#43585
PDF page: 80

Both the text and graphical depiction of the state machine ignore previous! when in state q10.--Seth Arnold

  • Reported in: P1.0 (06-Jun-10)
#43586
PDF page: 82
"Notice that we didn't call the new method on Quiz. We have to use the create method in order for the acts_as_state_machine magic to kick in and set t...more...
  • Reported in: P1.0 (06-Jun-10)
#43587
PDF page: 83

"we'll write a helper figure out"

s/helper figure/helper to figure/--Seth Arnold

  • Reported in: P1.0 (12-Sep-10)
#44988
PDF page: 89

The download url for attachment_fu is not longer valid. The new url is (http) @ github.com/technoweenie/attachment_fu.git--Wolfgang Barth

  • Reported in: P1.0 (10-Jun-08)
#32352
PDF page: 90
For the upload images with thumbnail you have the migration file for the Covers. I don't see a migration file for the actual Albums. Can you provide...more...
  • Reported in: P1.0 (06-Jun-10)
#43588
PDF page: 93
"Second, the form uses the file_field_tag helper (instead of f.file_field) to generate a Choose File button on the form." Why is the form using fil...more...
  • Reported in: P1.0 (05-May-08)
#31878
PDF page: 94
rescue and then just return false eats all exceptions (I for example had a type in the code), in my point of view this is very dangerous. Don't unders...more...
  • Reported in: P1.0 (01-Oct-08)
#34712
Paper page: 98
in the save method of the AlbumService, you have: if @cover.new_record? @album.cover.destroy if @album.cover @cover.album = @album @cover....more...
  • Reported in: B1.06 (16-Apr-08)
#31675
PDF page: 117
DynamicMetaTags has this code which fails on IE: def meta(name, content) %(<meta name="#{name}" content="#{content} />" ) end should be this...more...
  • Reported in: P1.0 (06-Jun-10)
#43589
PDF page: 131

"native text­--indexing extension." using a different hyphenation than "plug-in" or "T-search"--Seth Arnold

  • Reported in: B1.06 (05-Dec-09)
#41718
Paper page: 135
It says, "String-based fields (for example, the MySQL VARCHAR type) can often be easily indexed directly in the database where appropriate." Becaus...more...
  • Reported in: B1.06 (05-Dec-09)
#41719
Paper page: 139
It says, "you may want to change the name of the pid_file for the three environments so that you can run servers for each environment simultaneously."...more...
  • Reported in: B1.06 (05-Dec-09)
#41720
Paper page: 140
It says "Calling find_by_contents turns around behind the scenes..." However, there's a huge amount of space after "Calling". Maybe it's just in my ...more...
  • Reported in: P1.0 (05-May-08)
#31886
Paper page: 147
After the two rake commands on the 4th & 5th lines of p147, it says: "(If you're into shortcuts, these THREE Rake tasks..." I believe the third ...more...
  • Reported in: P1.0 (15-Dec-08)
#36446
PDF page: 156
Assuming that the sample results from Article.publicly_viewable and Article.premium are sorted by id, wouldn't Article.publicly_viewable.premium NOT i...more...
  • Reported in: P1.0 (07-Oct-08)
#34949
PDF page: 162

error_handling_form_builder.rb lists helpers in a series of %w(...) clauses. collection_select is duplicated --Brett Hughes

  • Reported in: B1.06 (15-Apr-08)
#31672
PDF page: 162
Keep Forms Dry, error_handling_form_builder.rb defines array of helpers; two are removed in the line "%w(label fields_for)" -- this should also includ...more...
  • Reported in: P1.0 (13-Aug-08)
#33957
PDF page: 171
OrdersController should show samples of all actions not just NEW and CREATE because you are likely going to need them. This would also distinguish the...more...
  • Reported in: P1.0 (12-Jun-10)
#43784
PDF page: 172
The implementation of OrderPresenter will allow form submissions to assign any value to any of the supported models, completely bypassing the attr_acc...more...
  • Reported in: P1.0 (18-May-08)
#32079
Paper page: 188

recipe #32 is a potential security problem.
Sending email.
--Michael Richardson

  • Reported in: B1.06 (05-Dec-09)
#41712
Paper page: 196
It says, "The encrypt method creates a new instance of the chosen cipher." I'm guessing that' it's actually Cipher.new that creates the new instance....more...
  • Reported in: B1.06 (05-Dec-09)
#41721
Paper page: 204
In the "Discussion" section for "Process Credit Card Payments", it'd be useful to mention that authorize.net has a customer information manager that c...more...
  • Reported in: B1.06 (05-Dec-09)
#41722
Paper page: 211
I'm looking at Geocoding/app/views/restaurants/search.html.erb. It's interesting to note that "restaurants" is pluralized, but "miles" isn't. It's p...more...
  • Reported in: P1.0 (05-Jun-08)
#32277
Paper page: 212
In the restaurants.html.erb layout file the line containing the google maps API key has a return character. When accessing the internet through a prox...more...
  • Reported in: P1.0 (09-Aug-08)
#33845
PDF page: 212
I think it should be mentioned where to get the class S3Uploader and what does it do (does it erase the filesystem files?, does it save the thumbnails...more...
  • Reported in: P1.0 (13-Aug-10)
#44602
Paper page: 212
to_json function behavior (Also please see contribution #42448 as reference) In Rails 2.3.5 your code does not work. In order to make your code ...more...
  • Reported in: P1.0 (13-Mar-10)
#42448
Paper page: 212
Rails version - 2.3.5 ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] gem version 1.3.6 The entry in app/layouts/restaurants.html.er...more...
  • Reported in: P1.0 (07-Jul-08)
#32679
PDF page: 216
If you don't use the "set_no_auto_load true" option described later in the recipe, the args passed to the create method will be nil which causes a nil...more...
  • Reported in: P1.0 (06-Jun-10)
#43590
PDF page: 218
"The billing_status method gets the status status" The variable is already named 'status', "status status" seems silly :) we don't want the status ...more...
  • Reported in: P1.0 (06-Jun-10)
#43591
PDF page: 220
"However, on a really busy day, we might have multiple shop owners all sending e-mails at the same time. And if the worker is already busy when a new ...more...
  • Reported in: P1.0 (01-Apr-10)
#42593
PDF page: 224
Implementing the acts_as_state_machine works perfectly when using the Pdf model inside controllers and the console. But no matter what I do I cannot c...more...
  • Reported in: P1.0 (06-Jun-10)
#43592
PDF page: 233

The procmail recipe is broken; it is missing the 'cd'.--Seth Arnold

  • Reported in: P1.0 (22-Dec-09)
#41891
PDF page: 235
The -otherwise excellent- recipe contains an nginx conf. snippet to make sure all requests return the maintenance page: if ($request_filena...more...
  • Reported in: B1.06 (05-Dec-09)
#41717
Paper page: 235
I'm reading the "Send Lightweight Messages" recipe. I'm worried that if the rake task crashes after getting the task, the task will be lost. A lot o...more...
  • Reported in: P1.0 (29-Jul-08)
#33354
PDF page: 238

Broken link to March Chung's plug-in.--Lauri Lehtinen

  • Reported in: P1.0 (18-Aug-08)
#34113
Paper page: 239

creating the worker as per the example, the job_key is not returned, though the code seems to work otherwise

  • Reported in: P1.0 (28-Jul-09)
#40239
Paper page: 242
It may be obvious to those that have been doing Rails for a while but for new folks you might want to mention that the Backgroundrb requires that you ...more...
  • Reported in: P1.0 (10-May-10)
#43170
PDF page: 247
Paper page: 247
Book says: class Addressable belongs_to :addressable, :polymorphic => true end But maybe it means: class Address ... end--Justin E My...more...
  • Reported in: P1.0 (06-Jun-10)
#43593
PDF page: 249
The entire RSpec recipe, I was waiting to find out why anyone would bother with using RSpec. I didn't see anything obvious while reading it that it co...more...
  • Reported in: P1.0 (06-Jun-10)
#43594
PDF page: 279

s/loop holes/loopholes/--Seth Arnold

  • Reported in: P1.0 (06-Jun-10)
#43595
PDF page: 280
In the epub version of the book, "underlying assertions:assert_w3c and assert_tidy". There is a linebreak in the pdf (and probably the paper :) but th...more...
  • Reported in: B1.06 (05-Dec-09)
#41713
Paper page: 288

It says, "One fairly unique feature of Shoulda is nested contexts." RSpec has this too, right?--Shannon -jj Behrens

  • Reported in: B1.06 (17-Apr-08)
#31680
PDF page: 291
In the first set of code examples on the page, a list of caching commands to execute through the console, in the last example of that section: >> p...more...
  • Reported in: P1.0 (09-May-08)
#31955
PDF page: 297
This recipe doesn't work. If I type Status::PENDING on the console, I always get a NameError: uninitialized constant Status::PENDING Maybe it's bec...more...
  • Reported in: P1.0 (03-Jun-08)
#32253
PDF page: 297
It should be mentioned that the caches_constants method does not play nice with tests (at least in Rails 2.0.2). Apparently fixtures are loaded aft...more...
  • Reported in: B1.06 (13-Apr-08)
#31659
PDF page: 300
I still get the "can't Fixnum into String" error when loading a page with '?browser_profile!' appended to the URL. This was reported for the previo...more...
  • Reported in: B1.06 (05-Dec-09)
#41711
Paper page: 301

It says "rake:test:acceptance". I think this should be "rake test:acceptance".--Shannon -jj Behrens

  • Reported in: P1.0 (25-Feb-09)
#37956
PDF page: 323
This is of little importance, but the second line in the "Problem" paragraph should probably start with "by HIPAA" (instead of "by HIPPA")--Jan Gänsle...more...
  • Reported in: P1.0 (06-Jun-10)
#43596
PDF page: 344
In the epub version of the book, 'devel-opment' has an embedded hyphen; the PDF looks fine, because there is a word-wrap there, so I assume adobe thin...more...
  • Reported in: B1.06 (05-Dec-09)
#41714
Paper page: 366
In this code, the salt is configured once for each environment. It'd be better if each and every piece of data was encrypted with a different salt. ...more...
  • Reported in: B1.06 (05-Dec-09)
#41715
Paper page: 368
I see "proxy_set header X_FORWARDED_PROTO https;". What happens if the user uses HTTP instead of HTTPS and manually sets that header?--Shannon -jj Be...more...
  • Reported in: B1.06 (05-Dec-09)
#41716
Paper page: 370
This recipe will redirect the user to HTTPS if he uses HTTP. However, if you accidentally submit a credit card over HTTP, it's too late--the game is ...more...
  • Reported in: P1.0 (06-Jun-10)
#43597
PDF page: 376
"One important caveat: Piston doesn't preserve change history from the remote repository. Piston just takes the latest revision, or differences betwee...more...
  • Reported in: P1.0 (14-Jun-08)
#32384
PDF page: 380
RE: subdomains as account keys: There's a weird issue with Leopard and request.subdomains -- I found the solution on the rails wiki (yeah, i know, ...more...
  • Reported in: P1.0 (13-Jan-11)
#46228
PDF page: 382
"... and call set_cookie domain only when ..." should be "... and call set_cookie_domain only when ... " (located near the end of the paragraph imme...more...
  • Reported in: P1.0 (14-Jul-08)
#33045
PDF page: 389

"Bibliography" section is given as a part of "Big picture recipes"--vzakharov@gmail.com

  • Reported in: P1.0 (16-May-08)
#32022
PDF page: 394

Index item for "Konkel, William" should be "Konkel, Warren".--Mike Clark

  • Reported in: B1.06 (05-Dec-09)
#41723
Paper page: 429
In the "Discussion" section of "Give Users Their Own Subdomain", I think you should add a few more caveats. If you give users their own subdomain, ...more...
  • Reported in: B1.06 (05-Dec-09)
#41724
Paper page: 432
It says: message = (String === message ? message : msg.inspect) Is it really supposed to say "String === message"? Is that really how you ...more...
  • Reported in: B1.06 (05-Dec-09)
#41725
Paper page: 433
In recipes_log_formatter.rb, it says: .gsub(/\n/, '').strip Why not replace newlines with spaces? That would be less confusing.--Shannon -jj...more...