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 P1.0,
released about 1 year 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.
| PDF |
Paper |
Description |
Found in |
Fixed in |
| 14 |
|
#37437: rake migrate is enough, no need to rake create before that--Reuben Sivan
|
P1.0
02-Feb-09
|
|
| 18 |
|
#37296: 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 edition (2) of the pickaxe does not mention it at all, and it really threw me for a loop.
As far as I can guess, if you have a method that takes a block, you can supply a symbol that represents another method's name (prefixed w/ & as usual), and the referenced method will get converted to a proc & sent to the first method, with the block parameters automatically getting supplied as parameters to the referenced method.
However I'd love for someone who actually *knows* what's going on here to independently confirm this.--Avram Dorfman #37296: 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 ...more...
|
P1.0
26-Jan-09
|
|
| 21 |
|
#37446: I'd suggest the reader at this point to add a search.html.erb file to display the search results--Reuben Sivan
|
P1.0
02-Feb-09
|
|
| 22 |
|
#37427: the method copy in this page is incomplete. The online code has it right.--Reuben Sivan
|
P1.0
01-Feb-09
|
|
| 26 |
|
#37451: in registrations/index.html.erb, the following line of code:
for registration in @registrations
should be
for registration in @event.registrations--Reuben Sivan #37451: in registrations/index.html.erb, the following line of code:
for registration in @registrations
should be
for registration in @event.regi ...more...
|
P1.0
02-Feb-09
|
|
| 32 |
|
#33955: Second to the last paragraph, last line, should probably say "as we'll see in *a* minute"
|
P1.0
13-Aug-08
|
|
| 70 |
|
#33413: 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. When I tried to replicate that model in a functional test, if wouldn't work unless I removed the array, and just made existing_task_attributes a hash based on the task idea rather than a nested hash.--David Johnson #33413: 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 ...more...
|
P1.0
31-Jul-08
|
|
| 73 |
|
#33044: The recipe is formatted differently from the others (has no "problem", "ingredients", "solution", etc. tabs). This looks messy--vzakharov@gmail.com
|
P1.0
14-Jul-08
|
|
| 73 |
|
#31852: 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 collection of two objects where the first was deleted inside the iterator. The iterator never iterated over the second object. Better to collect an array of tasks_to_be_deleted and then call tasks.delete(tasks_to_be_deleted) once outside the iterator. Also, tasks are deleted a different step and not wrapped within the same transaction as the rest of the update when the after_update is called.--Tim Harding #31852: 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 ...more...
|
P1.0
02-May-08
|
|
| 90 |
|
#32352: 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 the migation for the Albums? I can decipher some of the fields from the albums/new.html.erb form.--Southin Simphoukham #32352: 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 ...more...
|
P1.0
10-Jun-08
|
|
| 94 |
|
#31878: 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 understand why you don't just track the status of the first save in a local variable?--Philipp Knobel #31878: 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' ...more...
|
P1.0
05-May-08
|
|
|
98 |
#34712: in the save method of the AlbumService, you have:
if @cover.new_record?
@album.cover.destroy if @album.cover
@cover.album = @album
@cover.save
end
I think this should be
if @cover.new_record?
@album.cover.destroy if @album.cover
@album.cover = @cover
@cover.save
end
as Album has_one Cover and Cover belongs_to Album.
Or I'm missing something. But that's how I got it to work.
--Jim Graham #34712: in the save method of the AlbumService, you have:
if @cover.new_record?
@album.cover.destroy if @album.cover
@cover.album = @album
...more...
|
P1.0
01-Oct-08
|
|
| 117 |
|
#31675: DynamicMetaTags has this code which fails on IE:
def meta(name, content)
%(<meta name="#{name}" content="#{content} />" )
end
should be this (end quote incorrect)
def meta(name, content)
%(<meta name="#{name}" content="#{content}" />)
end
But why not use tag helper and be more railsy :-)
def meta(name, content)
tag("meta", :name => name, :content => content)
end--Tom Harrison #31675: DynamicMetaTags has this code which fails on IE:
def meta(name, content)
%(<meta name="#{name}" content="#{content} />" )
end
should ...more...
|
B1.06
16-Apr-08
|
|
|
147 |
#31886: 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 rake task it is referring to is
"rake ultrasphinx:configure"
from two pages prior. But I can't be sure and it is very unclear.--Drew Blas #31886: 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 th ...more...
|
P1.0
05-May-08
|
|
| 156 |
|
#36446: Assuming that the sample results from Article.publicly_viewable and Article.premium are sorted by id, wouldn't Article.publicly_viewable.premium NOT include #<Article id: 1> since nested scopes are AND'd and not OR'd?
It should only include those which are true for ALL of the named_scope filters.
>> Article.publicly_viewable
=> [#<Article id: 1,...]
>> Article.premium
=> [#<Article id: 2,...]
To find all publicly viewable and premium articles, we can nest the scopes:
>> Article.publicly_viewable.premium
=> [#<Article id: 1,...>, #<Article id: 2,...> ]
--Jakeb #36446: Assuming that the sample results from Article.publicly_viewable and Article.premium are sorted by id, wouldn't Article.publicly_viewable.premi ...more...
|
P1.0
15-Dec-08
|
|
| 162 |
|
#34949: error_handling_form_builder.rb lists helpers in a series of %w(...) clauses. collection_select is duplicated --Brett Hughes
|
P1.0
07-Oct-08
|
|
| 162 |
|
#31672: 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 include "hidden_field"
BTW -- this was a much needed recipe for my app. Now I need to figure out how to make it work for the scaffold generated "show" views, too :-)--Tom Harrison #31672: Keep Forms Dry, error_handling_form_builder.rb defines array of helpers; two are removed in the line "%w(label fields_for)" -- this should als ...more...
|
B1.06
15-Apr-08
|
|
| 171 |
|
#33957: 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 recipe from the one Jay Fields has on his website and summarize differences in working with the excluded actions. It seems incomplete to me. #33957: OrdersController should show samples of all actions not just NEW and CREATE because you are likely going to need them. This would also disting ...more...
|
P1.0
13-Aug-08
|
|
|
188 |
#32079: recipe #32 is a potential security problem.
Sending email.
--Michael Richardson
|
P1.0
18-May-08
|
|
|
212 |
#32277: 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 proxy this causes the key to be unrecognised. Simply making the src all one line solves the problem.
i.e change
<script type="text/javascript"
src="....file=api&v=2&
key=<%= GeoKit::Geocoders::google %>" >
</script>
to
<script type="text/javascript"
src="..... ?file=api&v=2&key=<%= GeoKit::Geocoders::google %>" >
</script>
N.B Had to remove the http part of the src in order to submit this erratum--Anthony Underwood #32277: In the restaurants.html.erb layout file the line containing the google maps API key has a return character. When accessing the internet throug ...more...
|
P1.0
05-Jun-08
|
|
| 212 |
|
#33845: 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?). #33845: 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 th ...more...
|
P1.0
09-Aug-08
|
|
| 216 |
|
#32679: 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 error to be raised. Checking args.nil? before running the args loop is recommended.--Mike Clark #32679: 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 caus ...more...
|
P1.0
07-Jul-08
|
|
| 238 |
|
#33354: Broken link to March Chung's plug-in.--Lauri Lehtinen
|
P1.0
29-Jul-08
|
|
|
239 |
#34113: creating the worker as per the example, the job_key is not returned, though the code seems to work otherwise
|
P1.0
18-Aug-08
|
|
| 291 |
|
#31680: 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:
>> products = Product.related_products("barney")
>> ActionController::Base.cache_store.fetch("barney") { products }
=> [#<Product id: 21, ...]
The description of fetch just below this says: " When it doesn’t find your key in the cache,
it’ll run the block, save its results into the cache, and give them back
to you."
But in this case the Product#related_products method gets executed before the call to fetch which is then only passed the reference to the already loaded collection.
Should the correct way to handle this not look like:
ActionController::Base.cache_store.fetch("barney") do
Product.related_products("barney")
end
?
--Jesse Clark #31680: 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: ...more...
|
B1.06
17-Apr-08
|
|
| 297 |
|
#31955: 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 because I'm using Postgres?--Lars Fischer #31955: This recipe doesn't work. If I type Status::PENDING on the console, I always get a NameError: uninitialized constant Status::PENDING
Maybe ...more...
|
P1.0
09-May-08
|
|
| 297 |
|
#32253: 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 after caches_constants is called which results in no constants being defined and tests failing due to this.
Assuming the following fixture:
pending:
name: Pending
active:
name: Active
disabled:
name: Disabled
Here's an ugly work-around for unit tests that calls caches_constants again after the fixtures are loaded:
def setup
# I'm assuming if Status::PENDING is undefined, so are the others
unless defined?(Status::PENDING)
Status.caches_constants
end
end
I hope you can come up with something better.
--Eric #32253: 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 lo ...more...
|
P1.0
03-Jun-08
|
|
| 300 |
|
#31659: 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 previous version as #31189 where it is marked as fixed in B1.06.
The line apparently with the problem is:
controller.response.body << printer.print("", 0)
--Chris Stephens #31659: 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 th ...more...
|
B1.06
13-Apr-08
|
|
| 323 |
|
#37956: 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änsler
|
P1.0
25-Feb-09
|
|
| 380 |
|
#32384: 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, something useful on the rails wiki ;) wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys.
basically, on leopard currently you need request.subdomains(0) instead of request.subdomains.
Might just want to link to that information in a footnote, b/c I'd bet a large chunk of your readers are Leopard readers and this is a pretty annoying bug.
thanks!--David Reese #32384: RE: subdomains as account keys:
There's a weird issue with Leopard and request.subdomains -- I found the solution on the rails wiki (yeah, ...more...
|
P1.0
14-Jun-08
|
|
| 389 |
|
#33045: "Bibliography" section is given as a part of "Big picture recipes"--vzakharov@gmail.com
|
P1.0
14-Jul-08
|
|
| 394 |
|
#32022: Index item for "Konkel, William" should be "Konkel, Warren".--Mike Clark
|
P1.0
16-May-08
|
|