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 5 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.
| 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
|
|
| 21 |
|
#47074: Routes syntax changed considerably in ROR 3.
The eg given map.resources :events, :collection => { :search => :get }
Should be
<code>
resources :events do
collection do
get 'search'
end
end
</code>
--Vlad Ivanovic #47074: Routes syntax changed considerably in ROR 3.
The eg given map.resources :events, :collection => { :search => :get }
Should be
<code>
...more...
|
P1.0
17-May-11
|
|
| 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
|
|
| 44 |
|
#47076: Download CatchAll404s/app/models/four_oh_four.rb
find_or_initialize
in code provided
find_and_initialize
in code description--Vlad Ivanovic
|
P1.0
18-May-11
|
|
|
50 |
#41710: 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. I see "ActiveRecord::Base.extend(CustomValidations)". Isn't this always mixing them in?--Shannon -jj Behrens #41710: 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 ...more...
|
B1.06
05-Dec-09
|
|
| 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
|
|
|
72 |
#40573: 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 seems to support that.
Also, in the prose, whenever params[something] is used, it's hard to tell if those are parenthesis or brackets. It may be a font thing.
Thanks!--Shannon -jj Behrens #40573: 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 ...more...
|
P1.0
27-Aug-09
|
|
| 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
|
|
| 80 |
|
#43585: Both the text and graphical depiction of the state machine ignore previous! when in state q10.--Seth Arnold
|
P1.0
06-Jun-10
|
|
| 82 |
|
#43586: "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 the initial state properly. Let's check that:"
Why doesn't new work? What's so funny about acts_as_state_machine? How would I know other plugins that require using 'create' instead of 'new'?--Seth Arnold #43586: "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 a ...more...
|
P1.0
06-Jun-10
|
|
| 83 |
|
#43587: "we'll write a helper figure out"
s/helper figure/helper to figure/--Seth Arnold
|
P1.0
06-Jun-10
|
|
| 89 |
|
#44988: The download url for attachment_fu is not longer valid. The new url is (http) @ github.com/technoweenie/attachment_fu.git--Wolfgang Barth
|
P1.0
12-Sep-10
|
|
| 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
|
|
| 93 |
|
#43588: "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 file_field_tag instead of f.file_field?--Seth Arnold #43588: "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 u ...more...
|
P1.0
06-Jun-10
|
|
| 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
|
|
| 131 |
|
#43589: "native text--indexing extension." using a different hyphenation than "plug-in" or "T-search"--Seth Arnold
|
P1.0
06-Jun-10
|
|
|
135 |
#41718: It says, "String-based fields (for example, the MySQL VARCHAR type) can often be easily indexed directly in the database where appropriate."
Because of the way you're using LIKE, it turns out MySQL won't use an index. Because MySQL has to examine every row, it turns out that a linear table scan is faster than scanning the entire index. That's why MySQL won't use an index if it has to scan the entire table (unless the index would help with ordering). It's helpful to use "explain" on the query in order to double check whether MySQL is or isn't using an index.
Happy Hacking!--Shannon -jj Behrens #41718: It says, "String-based fields (for example, the MySQL VARCHAR type) can often be easily indexed directly in the database where appropriate."
...more...
|
B1.06
05-Dec-09
|
|
|
139 |
#41719: 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."
To run more than one server, you're also going to need a different port for each.--Shannon -jj Behrens #41719: 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 simultan ...more...
|
B1.06
05-Dec-09
|
|
|
140 |
#41720: 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 version, but it's as if someone had their hand resting on the space bar ;)--Shannon -jj Behrens #41720: It says "Calling find_by_contents turns around behind the scenes..." However, there's a huge amount of space after "Calling". Maybe it's jus ...more...
|
B1.06
05-Dec-09
|
|
|
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
|
|
| 172 |
|
#43784: The implementation of OrderPresenter will allow form submissions to assign any value to any of the supported models, completely bypassing the attr_accessible or attr_protected safeguards that those models (should) have in place. (Well, it isn't _any_ value -- the values still must pass validation -- but valid values can also be values that should not be set in bulk: account.admin=1. Or credential_username=root, credential_password=foobar.)
A correct implementation would not just blindly send() the constructed method -- it must call or re-implement the attr_protected/attr_accessable checks that ActiveRecord supports. Or support only a specifically-named small list of allowed methods.--Seth Arnold #43784: The implementation of OrderPresenter will allow form submissions to assign any value to any of the supported models, completely bypassing the ...more...
|
P1.0
12-Jun-10
|
|
|
188 |
#32079: recipe #32 is a potential security problem.
Sending email.
--Michael Richardson
|
P1.0
18-May-08
|
|
|
196 |
#41712: 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.--Shannon -jj Behrens
|
B1.06
05-Dec-09
|
|
|
204 |
#41721: In the "Discussion" section for "Process Credit Card Payments", it'd be useful to mention that authorize.net has a customer information manager that could completely alleviate the need for this recipe and make it easier to achieve PCI compliance. I was a confused when I read this recipe because I was looking for how to *process* credit card numbers, not how to *store* credit card numbers. It might make sense to change the chapter's title.
Also, while I'm definitely no Ruby on Rails expert, it seems to me that set_encryption_password isn't thread safe. I thought Rails 3 was supposed to support threaded servers, so being non-thread-safe might be a big deal. Who knows if that'll ever actually happen, but it might at least warrant a comment in the code.--Shannon -jj Behrens #41721: In the "Discussion" section for "Process Credit Card Payments", it'd be useful to mention that authorize.net has a customer information manage ...more...
|
B1.06
05-Dec-09
|
|
|
211 |
#41722: 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 probably best to always pluralize or never pluralize.--Shannon -jj Behrens #41722: I'm looking at Geocoding/app/views/restaurants/search.html.erb. It's interesting to note that "restaurants" is pluralized, but "miles" isn't. ...more...
|
B1.06
05-Dec-09
|
|
|
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
|
|
|
212 |
#44602: 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 work as expected, add statement ActiveRecord::Base.include_root_in_json = false to config/initializers/new_rails_defaults.rb file
Otherwise, Json string would have format: [{"restaurant":{"name":, etc.], so the proper reference would be restaurant[1].restaurant.name, i.e. to get the name of the first restaurant.
--Dave Borcic #44602: 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 yo ...more...
|
P1.0
13-Aug-10
|
|
|
212 |
#42448: 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.erb -
var restaurants = <%= @restaurants.to_json %>;
Show's up in the browser as
var restaurants = [{"restaurant":{"name":"Ykui Sushi","address":"9447 Park Meadows Dr, Lone Tree, CO","created_at":"2010-03-13T00:08:48Z","updated_at":"2010-03-13T00:08:48Z","lng":-104.879512,"id":2,"lat":39.554912,"distance":"0.999219415981368"}},{"restaurant":{"name":"Sushi Wave","address":"9555 E Arapahoe Road, Greenwood Village, CO","created_at":"2010-03-13T00:09:54Z","updated_at":"2010-03-13T00:09:54Z","lng":-104.878099,"id":3,"lat":39.595709,"distance":"1.84318061453223"}},{"restaurant":{"name":"Sushi Terrace","address":"8162 S Holly St, Littleton, CO","created_at":"2010-03-13T00:10:50Z","updated_at":"2010-03-13T00:10:50Z","lng":-104.9230185,"id":4,"lat":39.5688859,"distance":"2.50444556563776"}}];
(After I entered the sample data).
The restaurants variable is then referenced in public/javascripts/application.js to create a marker like such ...
var latlng = new google.maps.LatLng(restaurants[i].lat,restaurants[i].lng)
which is undefined in Javascript.
My fix ---
layouts/restaurants.html.erb
var found = <%= @restaurants.to_json %>;
javascripts/application.js
var latlng = new google.maps.LatLng(found[i].restaurant.lat,found[i].restaurant.lng);
I suupose you could just change application.js to
var latlng = new google.maps.LatLng(restaurant[i].restaurant.lat,restaurant[i].restaurant.lng);
Not sure what the @restaurants.to_json function is supposed to return and may well have worked differently when the recipe was written.
Just thought you should know of this gotcha.
--Martin Burke #42448: 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 ...more...
|
P1.0
13-Mar-10
|
|
| 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
|
|
| 218 |
|
#43590: "The billing_status method gets the status status"
The variable is already named 'status', "status status" seems silly :) we don't want the status of the status, we want the actual status.--Seth Arnold #43590: "The billing_status method gets the status status"
The variable is already named 'status', "status status" seems silly :) we don't want the ...more...
|
P1.0
06-Jun-10
|
|
| 220 |
|
#43591: "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 task arrives, the work won't get queued."
Wow, I was surprised when I read that workers are unreliable, and thread pools must be used to make 'reliable workers'. I'd read pages of code, and then this snippet is buried in as an afterthought seven pages into the recipe! It seems like it'd be useful to put this information near the front of the discussion of workers.
(And the code to make the workers reliable is stuck in each individual worker? seems like a recipe for cut-n-paste disasters..)--Seth Arnold #43591: "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 whe ...more...
|
P1.0
06-Jun-10
|
|
| 224 |
|
#42593: 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 call the event methods inside the simple daemon class.
#42593: 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 ...more...
|
P1.0
01-Apr-10
|
|
| 233 |
|
#43592: The procmail recipe is broken; it is missing the 'cd'.--Seth Arnold
|
P1.0
06-Jun-10
|
|
| 235 |
|
#41891: The -otherwise excellent- recipe contains an nginx conf. snippet to make sure all requests return the maintenance page:
if ($request_filename ~* \.(css|jpg|gif|png)$) {
break;
}
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
However, that does not work since it gets into an inf. loop on the maintenance page (/system/maintenance.html) itself.
The (or rather 'a') correct config is the following:
if ($request_filename ~* \.(css|jpg|gif|png)$) {
break;
}
if ($request_filename = $document_root/system/maintenance.html) {
break;
}
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html last;
break;
}
I hope that helps,
Bálint--Balint Erdi #41891: The -otherwise excellent- recipe contains an nginx conf. snippet to make sure all requests return the maintenance page:
if ($reques ...more...
|
P1.0
22-Dec-09
|
|
|
235 |
#41717: 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 of queue software tries to handle this case.
For instance, if a worker takes too long, the manager will assume he's borked and reassign the task to another worker.--Shannon -jj Behrens #41717: 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. ...more...
|
B1.06
05-Dec-09
|
|
| 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
|
|
|
242 |
#40239: 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 call the prototype.js script from scriptaculous when you include the periodically_call_remote as you get a Javascript error that "PeriodicalExecuter is undefined".--Craig #40239: 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 t ...more...
|
P1.0
28-Jul-09
|
|
| 247 |
247 |
#43170: Book says:
class Addressable
belongs_to :addressable, :polymorphic => true
end
But maybe it means:
class Address
...
end--Justin E Myers
|
P1.0
10-May-10
|
|
| 249 |
|
#43593: 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 could do that standard Rails test infrastructure couldn't do. Is it basically a way to say "should have_tag()" rather than "assert_select tag..."?
I'm not sure adding a ton of new synonyms to the language is worthwhile, so there'd better be something _useful_ to RSpec to bother talking about it.--Seth Arnold #43593: 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 th ...more...
|
P1.0
06-Jun-10
|
|
| 279 |
|
#43594: s/loop holes/loopholes/--Seth Arnold
|
P1.0
06-Jun-10
|
|
| 280 |
|
#43595: 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 the epub is missing any whitespace between assertions and assert_w3c.--Seth Arnold #43595: 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 : ...more...
|
P1.0
06-Jun-10
|
|
|
288 |
#41713: It says, "One fairly unique feature of Shoulda is nested contexts." RSpec has this too, right?--Shannon -jj Behrens
|
B1.06
05-Dec-09
|
|
| 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
|
|
|
301 |
#41711: It says "rake:test:acceptance". I think this should be "rake test:acceptance".--Shannon -jj Behrens
|
B1.06
05-Dec-09
|
|
| 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
|
|
| 344 |
|
#43596: 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 things need to be told how to hyphenate "development" automatically :)--Seth Arnold #43596: 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 ad ...more...
|
P1.0
06-Jun-10
|
|
|
366 |
#41714: 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. The salt should be stored with each piece of data in the database. That's how Linux password files work. It's something like:
salt = something_random_for_each_record
encrypted = encrypt(data + salt + site_wide_password) + salt
The site_wide_password is really the key. The salt is there just to thrown a monkey wrench in the works and make things a bit harder to figure out the site_wide_password.
--Shannon -jj Behrens #41714: 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 ...more...
|
B1.06
05-Dec-09
|
|
|
368 |
#41715: 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 Behrens
|
B1.06
05-Dec-09
|
|
|
370 |
#41716: 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 already over and a redirect won't help. That's why I've decided that such situations should result in a 404. If it's flat out broken, then I'll realize the problem faster and fix it. A redirect could cover up the real problem.
Maybe you should mention this in the "Discussion" section.--Shannon -jj Behrens #41716: 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 ...more...
|
B1.06
05-Dec-09
|
|
| 376 |
|
#43597: "One important caveat: Piston doesn't preserve change history from the remote repository. Piston just takes the latest revision, or differences between what you currently have and the latest revision, and merges those changes into your checked-out copy. However, you can examine the changes before committing them to your local repository."
Wow. Piston sounds like a pretty poor replacement for git. Piston might make it possible to tolerate svn:externals, but I think a bigger service to readers would be to suggest using the right tool for the right job. If you just want CVS but with changesets, svn is pretty good. If you want to perform distributed version management, that's pretty firmly outside svn's mission statement, and something like git would probably serve you way better.--Seth Arnold #43597: "One important caveat: Piston doesn't preserve change history from the remote repository. Piston just takes the latest revision, or difference ...more...
|
P1.0
06-Jun-10
|
|
| 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
|
|
| 382 |
|
#46228: "... and call set_cookie domain only when ..." should be "... and call set_cookie_domain only when ... " (located near the end of the paragraph immediately following the code snipped for "Subdomains/app/controllers/application.rb")--Brett Valantine #46228: "... and call set_cookie domain only when ..." should be "... and call set_cookie_domain only when ... " (located near the end of the paragr ...more...
|
P1.0
13-Jan-11
|
|
| 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
|
|
|
429 |
#41723: 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, it's important that you not allow them to upload Flash or JavaScript content. You should even make sure they can't upload Flash content and pretend it's an image. If they can upload Flash or JavaScript for andy.example.com, they can hijack sessions for all of example.com. Having recently read the security section for ActionScript, there's all sorts of nasty things users can do if you let them upload their own ActionScript onto your domain.
I think that's why Blogger makes me author my blog posts on blogger.com, but my actual blog lives at blogspot.com.--Shannon -jj Behrens #41723: 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 sub ...more...
|
B1.06
05-Dec-09
|
|
|
432 |
#41724: It says:
message = (String === message ? message : msg.inspect)
Is it really supposed to say "String === message"? Is that really how you check if message is a string?
Where is "msg" coming from?--Shannon -jj Behrens #41724: It says:
message = (String === message ? message : msg.inspect)
Is it really supposed to say "String === message"? Is that really ...more...
|
B1.06
05-Dec-09
|
|
|
433 |
#41725: In recipes_log_formatter.rb, it says:
.gsub(/\n/, '').strip
Why not replace newlines with spaces? That would be less confusing.--Shannon -jj Behrens
|
B1.06
05-Dec-09
|
|
| 2003 |
XrHAb |
#49585: Interesting post. Came across while senhrciag for a download. Read the book a long time ago and agree with most of your references. Think I have one more: the part where amloki follows Bali by making out the tracks of the horse-girl (don't remember the name, but this one also from Harry Potter) and other marks sounds like something Sherlock Holmes does in a spoofy way.--aHlRGDmMJWTuKWmB #49585: Interesting post. Came across while senhrciag for a download. Read the book a long time ago and agree with most of your references. Think I ha ...more...
|
P1.0
26-Jul-12
|
|