Errata for Agile Web Development with Rails, Third Edition
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 2 months 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 |
| 7-1 |
|
#43547: There isn't an option for the epub version. Any ways, on chapter 7 page 5 there are two links to figures "Flow of buyer pages" and "Flow of seller pages" that point to the other figure. Buyer links to seller and vise versa--Tim Foster #43547: There isn't an option for the epub version. Any ways, on chapter 7 page 5 there are two links to figures "Flow of buyer pages" and "Flow of s ...more...
|
P6.0
04-Jun-10
|
|
| 31 |
|
#42996: MySQL is included in InstantRails, not SQLite--LH Emmink
|
P5.0
27-Apr-10
|
|
| 32 |
|
#43695: rails dummy_app should read rails new dummy_app--Mark Horrocks
|
P6.0
09-Jun-10
|
|
|
68 |
#44024: I am using SQLite 3.
Towards the end of the first paragraph (in parenthesis) its says,
"And how will you find that table? The development entry in config/database.yml tells Rails where to look for it. For SQLite 3 users, this will be a file in the db directory."
This could be a typo but I find the database.yml in the config directory and not the db. As I mention before, I am a SQLite 3 user.
--Roberto #44024: I am using SQLite 3.
Towards the end of the first paragraph (in parenthesis) its says,
"And how will you find that table? The developm ...more...
|
P4.0
10-Jul-10
|
|
| 81 |
|
#42929: 6.1 Iteration A1 in the paragraph discussing rake test
"The are minimal at this point, but simply knowing that" instead of "They are minimal at this point".--Brian Hall #42929: 6.1 Iteration A1 in the paragraph discussing rake test
"The are minimal at this point, but simply knowing that" instead of "They are minima ...more...
|
P5.0
23-Apr-10
|
|
| 102 |
|
#43461: The session_store / DB / ActiveRecord setting no longer resides in environment.rb. (Using Rails 2.3.5.)
For using the "ActionController::Base.session_store = :active_record_store" setting.
The correct file in Rails is now "session_store.rb" in the configuration/initializers directory. --Kenneth Wagner #43461: The session_store / DB / ActiveRecord setting no longer resides in environment.rb. (Using Rails 2.3.5.)
For using the "ActionController::Ba ...more...
|
P6.0
26-May-10
|
|
| 151 |
|
#43712: In save_order method no check for cart's emptiness. i may go to checkout and press "empy cart" button. and after pressing "place order" button, an order is saved with no line_items.--Sam #43712: In save_order method no check for cart's emptiness. i may go to checkout and press "empy cart" button. and after pressing "place order" button ...more...
|
P6.0
11-Jun-10
|
|
| 163 |
|
#43363: Sorry if I'm mixed up here (I'm a newbie to RoR), but I believe that in 'password_non_blank' (in 'user.rb'), there's a missing colon before 'hashed_password'. I think the line should read:
errors.add(:password, "Missing Password") if :hashed_password.blank?
--Noam #43363: Sorry if I'm mixed up here (I'm a newbie to RoR), but I believe that in 'password_non_blank' (in 'user.rb'), there's a missing colon before 'h ...more...
|
P5.0
21-May-10
|
|
| 337 |
|
#43472: In the example for named scopes, the plural of the model is used ("Orders" instead of "Orders"):
orders = Orders.last_n_days(7)
Also on the next page:
in_house = Orders.scoped(:conditions => 'email LIKE "%@pragprog.com"')--Michael Chaney #43472: In the example for named scopes, the plural of the model is used ("Orders" instead of "Orders"):
orders = Orders.last_n_days(7)
Also on ...more...
|
P6.0
27-May-10
|
|
| 343 |
|
#43556: all is not a scope, it's a class method def which calls find :all - it doesn't return a scope proxy
|
P6.0
05-Jun-10
|
|
| 378 |
|
#43114: The section describing STI on page 377 lists the hierarchy of model objects.
There is followed by fugure 19.2 at the top ofpage 378 followed by the last model in the hierarchy (Manager). It would be less confusing if this was above the diagram so that it flows in with the other models used.
The confusion arose because I totally missed that model and had to re-track a bit.
Hope that makes sense--James West #43114: The section describing STI on page 377 lists the hierarchy of model objects.
There is followed by fugure 19.2 at the top ofpage 378 followed ...more...
|
P5.0
06-May-10
|
|
| 479 |
|
#43901: The link to media.pragprog.com/ror/sessions in footnote 8 of chapter 22 gives a 404 error.--Steven Littiebrant
|
P6.0
27-Jun-10
|
|
| 506 |
|
#43519: link_to(:action => :delete, :confirm => "Are you sure?") will prevent spiders from executing the delete request, because a GET instead of (POST) DELETE request will be sent to the server & routing will ignore the request / raise error / show a confirmation page. #43519: link_to(:action => :delete, :confirm => "Are you sure?") will prevent spiders from executing the delete request, because a GET instead of (POS ...more...
|
P6.0
31-May-10
|
|
| 523 |
|
#42994: In figure 23.1 I'd imagine that #5 should actually reference a create action rather than a save action for it to follow convention.--Zack Hubert
|
P5.0
27-Apr-10
|
|
| 560 |
|
#44050: The last part of the section on caching needs cleanup or more explanation:
ActionController::Base.cache_store = <one of the following>
...
:mem_cache_store, "localhost" ActionController::Base.cache_store = MyOwnStore.new("parameter")
This stores fragments in a memcached server. #44050: The last part of the section on caching needs cleanup or more explanation:
ActionController::Base.cache_store = <one of the following>
. ...more...
|
P6.0
11-Jul-10
|
|
| 610 |
|
#43527: delivery errors are not mentioned at all, tips on handling this seem v important for production where mail addresses may not exist & make the site crash, esp. when setting up some kind of mass-mailer, e.g. all of a site's members where a couple have invalid email addresses & crash the delivery process (or not? how does it work?) #43527: delivery errors are not mentioned at all, tips on handling this seem v important for production where mail addresses may not exist & make the ...more...
|
P6.0
02-Jun-10
|
|
| 734 |
|
#43040: Index lists assert_not_match. Should be assert_no_match.
|
P5.0
01-May-10
|
|
Stuff To Be Considered in the Next Edition
| PDF |
Paper |
Description |
Found in |
Fixed in |
|
18 |
#41589: ERb is defined as "Embedded Ruby" on p. 18 but is not in the index, please add to index. P2.0 printing April 2009 Version: 2009-4-7, please add this printing to the selection dropdown for Errata as well, this is the paper version I have. Thanks.--M. Roxas #41589: ERb is defined as "Embedded Ruby" on p. 18 but is not in the index, please add to index. P2.0 printing April 2009 Version: 2009-4-7, please a ...more...
|
P1.0
21-Nov-09
|
|
|
114 |
#42012: To produce the sans-serif cart title shown in the "screen-shot", the css for .cart-title needs to be "font: bold 120% sans-serif;". ("120% bold" fails in both Safari 4.0.4 and Firefox 3.5.5)
I believe erratum notification #41977 is incorrect and should be removed - the item price is defined in cart_item.rb to be the product price times the quantity in the cart.--Allan Kinnaird #42012: To produce the sans-serif cart title shown in the "screen-shot", the css for .cart-title needs to be "font: bold 120% sans-serif;". ("120% bo ...more...
|
P4.0
05-Jan-10
|
|
| 137 |
|
#42022: For those who did the additional problem of linking using the book image. Here is the AJAX code to perform the same task as the new AJAX button:
<%= link_to_remote (image_tag(product.image_url), :url => { :action => 'add_to_cart',:method => :post, :id => product }) %>
Which is inserted between <div class="entry" and <h3><%= product.title %>--Andrew Szczepanski #42022: For those who did the additional problem of linking using the book image. Here is the AJAX code to perform the same task as the new AJAX butto ...more...
|
P1.0
08-Jan-10
|
|
| 171 |
|
#41917: As of the end of section 11.2 the admin_controller function is not working as intended in the case of erroneous logins.
Having a seperate terminal window to view messages I see the flow of login and password unhashed (is this a possible security hole?). Upon proper credentials, the user is sent to the /admin address. As intended. However upon improper credentials, the page is reloaded (intended) but the
flash.now[:notice] = "Invalid user/password combination"
is not kicking in.
I assumed that because of the lack of a views/layouts/admin.html.erb
file, this was occuring.
Upon creation of that file (a simple duplicate of users.html.erb - which in itself is raising a non-DRY issue)
the message appears.
I'm definitely a newbie. This is an interesting bug to leave lying around as an exercise (confirms learning).
But I'm also curious about the security hole and non-DRY issue at hand and resolving it.--Jerome Marchand #41917: As of the end of section 11.2 the admin_controller function is not working as intended in the case of erroneous logins.
Having a seperate t ...more...
|
P4.0
26-Dec-09
|
|
| 203 |
|
#41429: The i18n.t examples are leaving the colon out of the message, for example:
<%= form.label :name, I18n.t('checkout.name') + ":" %>
This should be consider bad i18n, since some languages may and do want to use different character for the colon, or leave it out altogether. It is also a sign for translators that it is used as a label.
--Niklas Laxström #41429: The i18n.t examples are leaving the colon out of the message, for example:
<%= form.label :name, I18n.t('checkout.name') + ":" %>
This sho ...more...
|
P1.0
14-Nov-09
|
|
| 204 |
|
#41924: On the use of UTF-8, HTML and Javascript...
Page 194, section 13.1 states:
"if you do this, just make sure that your editor is configured for UTF-8."
But then when dealing with the localisations for the checkout, the following is presented:
address: "Dirección"
pay_prompt: "Seleccione un m\xC3\xA9todo de pago"
which is a by-product of passing the values via javascript I suspect.
Presently, I literally have a situation where the i18n.rb file has the tilde-n inserted as such and renders (I saved it in UTF-8, no BOM encoding) . The es.yml file has a mix of HTML and hex characters (it does not take kindly to UTF-8 encoding). Three flavours for one objective; dispersive, if not un-DRYish.
This is a point for a someoneSays box to highlight some pitfalls. And maybe suggestions.
Above all, a language file in hexa is rather difficult to read, increases data entry problems, lengthens checking (what will the professional translator do? Upon creation is one thing, upon editing is another! [scent of bad coupling]) and gets moreso as its size increases. Needs to be avoided...--Jerome Marchand #41924: On the use of UTF-8, HTML and Javascript...
Page 194, section 13.1 states:
"if you do this, just make sure that your editor is configured f ...more...
Sam Ruby says: There's a bug report on Rails open on this: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2409-activerecord-double-escapes-error_messages_for
I plan to address this in the next edition.
|
P4.0
26-Dec-09
|
|
| 412 |
|
#42273: In the discussion of how to build a callback class and express it throughout all models, I think that a critical question is not addressed:
(1) how do we get this file "sourced" into the Rails runtime. If you put it in lib as a module does it automatically get loaded up? How can we get it to run as the environment boots up. The example source file is given as a stand-alone script.
(2) It appears that we're being encouraged to monkey-patch ActiveRecord::Base. While the ability to do this is one of the amazing joys of Ruby, it might be good to explain why this may or may not be a good idea. Many a tweet has gone out on the difficulty monkeypatching has introduced in code-sharing / debugging.--Steven Harms #42273: In the discussion of how to build a callback class and express it throughout all models, I think that a critical question is not addressed:
...more...
|
P5.0
08-Feb-10
|
|
| 563 |
|
#42439: I think that this chapter is off from the general character and tenor of the rest of the book. It feels very much "bolted-on."
The chapter opens strongly, setting up a tri-partite discussion framework and a one-sentence characterization of each of the parts (Prototype, Scriptaculous, RJS). What I consider to be one of the highlights of pragprog books is the way that examples and working assignments are given, and often. This chapter delivers on the example on the second page; however the "how to build up to this" is not given.
Now you MIGHT think this is acceptable (oh you're twenty-someodd chapters in, you can make this example work), but didn't the reader just PAY to have you be verbose and teach? Further, we're learning something new, AJAX. We're learning it without any context, it seems an unfair leap to expect that the reader will be able to execute the harness application flawlessly such that the rest of the lesson might be applied. Perhaps a github link to a baseline project would be helpful if you're committed to not adding text.
Furthermore, no context is given in the code examples. It looks to me like there's some pagination-fu at the base of the view. Where did that chant come from?
I don't expect this chapter to be a be-all-end-all description of Ajax and Rails, but the presentation on this topic in this book has pushed me to buy the ORA "Ajax on Rails" book. #42439: I think that this chapter is off from the general character and tenor of the rest of the book. It feels very much "bolted-on."
The chapte ...more...
|
P5.0
11-Mar-10
|
|
| 632 |
|
#42401: The description of nested resources in ActiveResource is missing a critical piece. The LineItem model in depot_client is not shown, most importantly the special self.site path with orders/:order_id.
Also the LineItemsController in depot_t does not properly return only the line items for the specified order. Instead it returns all line items for all orders.--Scott Johnson #42401: The description of nested resources in ActiveResource is missing a critical piece. The LineItem model in depot_client is not shown, most impor ...more...
|
P5.0
02-Mar-10
|
|
| 657 |
|
#41595: The instructions for creating the empty git repository assume git has been installed on the git server. But the reader was not told to install git. "$ git --bare init" will fail if git is not installed. This was found in p3.0, 2009-9-21 PDF.--Jamie Allen #41595: The instructions for creating the empty git repository assume git has been installed on the git server. But the reader was not told to instal ...more...
|
P1.0
22-Nov-09
|
|