By Developers, For Developers

Historical errata for Agile Web Development with Rails

"

The " seems unnecessary/typo.

PDF PgPaper PgTypeDescriptionFixed onComments
74OK

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 script/generate scaffold product \\
exists app/models/
exists app/controllers/
exists app/helpers/
create app/views/products
exists app/views/layouts/
exists test/functional/
exists test/unit/
create app/views/products/index.html.erb
wrong number of arguments (1 for 2)

(Sam says: The footnote already says that Windows users will need to put the entire command on one line, without the backslash)

2008-08-14
87OK

The source code at depot_c/db/migrate/003_add_test_data.rb has a comment after the second product (approx line 43) that appears to be extraneous.

The comment suggests that something has been ellided from the text. While this makes sense for the listing in the book (since it only shows 1 product), it is somewhat confusing in the source listing since all three products are, in fact, listed.

(Dave says: I’m afraid that just a side effect of live code inclusion—the code in the book is derived from these source files, and sometimes we need to include stuff to flag elided material)

2008-05-12
76TYPO

The images on pp 76-77 appear to use the old-style URL for the controller - //localhost:3000/admin. As far as I can tell, the proper URL is //localhost:3000/products.

Note also that the text immediately before the last image on pg 76:

“Remember, the URL we give to our browser contains both the port number(3000) and the name of the controller in lowercase (product).”

This implies a URL of //localhost:3000/product - which produces in an error.

(not allowing URLs in erratum submissions makes pointing out problems with URLs in the book a little difficult)

2008-05-23
87SUGGEST

The link in footnote 2 for the images (depot_c/public/images) might cause confusion for some people. Because the link is for a directory, clicking on the link results in a permission denied error (presumably because the server is configured to not allow directory listings). While many may figure out what the problem is and figure out that you can go to the source code for the migration to get the names of the individual image files, others will simply assume a server problem and give up.

If reconfiguring the server to allow the directory list is not an option, it would probably be helpful to either put the URLs for the individual images in the footnotes, or to at least add some text to the footnote indicating that you’ll need to consult the migration in order to construct the proper URLs.

2008-04-24
89TYPO

The following text on pg 89

“Now that we have the stylesheet all in place, we’ll use a simple table-based template, editing the file list.html.erb in app/views/product, replacing the scaffold generated view.”

seems to indicate that the template goes in a file named app/views/product/list.html.erb, yet the link for downloading the source indicates the file should be named app/views/product/index.html.erb

2008-05-11
94TYPO

The image on p 94 show the name of the template file as index.rhtml instead of index.html.erb

2008-05-23
96ERROR

When refreshing my display as suggested on page 71, the results in my browser do not look the same as what is displayed in figure 7.1. There are two issues.

First, the description text is truncated at 255 characters. As the description field for each of the products in the database only contains 255 characters, this is not surprising. (I’m using mysql 5.) Suggest either changing the test data so the description contains less than 255 characters, or adding something to the tutorial to make the field able to hold more than 255 characters.

The second issue is that in my browser, there is no line break between the description and the price as there is in figure 7.1. I believe this is a result of the description field being truncated and losing the closing /p tag.

2008-05-12
97SUGGEST

The template listing on pg 97 references logo.png. While the text on pg 98 indicates that you will need to update your css file in order to make the example work, there’s no indication that you need to get the image file as well.

This issue is moot if the resolution to #31708 is to configure the web server to allow directory listings.

2008-05-23
102SUGGEST

The link on pg 102 points to a page that says the wiki has moved. The redirects and links eventually get you to the right place, but unless this is a temporary situation, it would seem appropriate to update the link in the book to point directly to the correct place.

2008-05-11
105SUGGEST

The statement on pg 105

“The next time you restart your application (stopping and starting script/server), it will store its session data in the database. Why not do that now?”

suggests (to me at least) that my application will now work properly with cookies. Yet restarting the server as suggested and then trying to view a page in my browser results in an error.

Patient readers will discover the remedy in the next section, but it would be nice to include an indication that while a restart is necessary, there’s still one more thing to do before the cookie stuff works properly.

2008-08-10
36TYPO

Where:
Section 3.4 Installing on linux. Line 2 of the installation commands.

What:
The package “libsqllite3-dev” did not work for me. I think the double ‘l’ is a typo, because “libsqlite3-dev” worked fine.

2008-05-11
108TYPO

There appears to be a word (or two) missing from the following:

“On line we use the find_cart method we …”

Should this be ‘On the second line, we …’?

2008-05-11
108TYPO

This sentence appears to be missing a word:

“Line then adds this product to the cart.”

One guess at what’s missing implies that the source listing above it should have line numbers.

2008-05-11
74ERROR

“depot> ruby script/generate scaffold product \\
> title:string description:string image_url:string”
should read:
“depot> ruby script/generate scaffold product \\
> title:string description:text image_url:string” to produce the example shown on page 77

2008-05-11
93OK

After issuing the command “ruby script/generate controller store index”, it seems like the server needs to be restarted in order to correctly display store controller index. As a beginner, who probably missed this tip if it was mentioned earlier in the book, it took me a while to figure this out.

(Sam says: I don’t believe that a server restart is required)

2008-05-11
40TYPO

3rd paragraph, last sentence:

Change this:
If you installed our own copy of Ruby

To this:
If you installed your own copy of Ruby

2008-05-11
21ERROR

“gem_server” didn’t work for me (on Mac OS X Leopard). I looked it up on the web and found it had been replaced by simply “gem server” with a space instead of an underscore, which worked perfectly.

2008-05-11
89TYPO

The top listing has not added the depot stylesheet as mentioned in the previous page. Line 8 should read:
<%= stylesheet_link_tag ‘scaffold’, ‘depot’ %>

2008-05-11
36TYPO

“sudo aptitude install ruby […] libsqllite3-dev”:

this line probably should be “[…] libsqlite3-dev”. Ubuntu does not find a packet with 2 “l”.

2008-05-11
77ERROR

First screen on the page : description is in a textarea, if we follow the scaffolding method on page 76, we have a textfield. We declare the description as a string and not as a text.

2008-05-11
200SUGGEST

Generated functional tests of rails 2.0.2 aren’t subclass of Test::Unit::TestCase, but ActionController::TestCase.
I suppose the book should be illustrate new with latest information, and I would like to see how we override setup and teardown.

2008-08-14
2TYPO

“It is anticipated that these release will introduce…”

“these release” should probably be "this release

2008-05-11
30TYPO

puts “Order #{order.customer_id}, amount=#{order.amount}”

Since this line apparently prints a customer id, it would make more sense as:

puts “Customer #{order.customer_id}, amount=#{order.amount}”

2008-05-11
31SUGGEST

In last paragraph:

Sentence reads, “The most common templating scheme, called html.erb, embeds snippets of Ruby code within the view’s HTML using a Ruby tool called ERb (or Embedded Ruby).”

Suggestion: something like,
“The most common templating scheme, called ERb (or Embedded Ruby), embeds snippets of Ruby code within a view document - typically an HTML document.”

2008-05-11
32ERROR

Paragraph reads:

“ERb can also be used to construct XML documents using Ruby code—the structure of the generated XML will automatically follow the structure of the code. We discuss xml.erb templates starting on page 469.”

Isn’t this describing Builder, and not ERb?

2008-05-11
36TYPO

Section 3.3, First paragraph:

“You’ll need to update this this to Rails~2.0”

Duplicate ‘this’
Also, not sure if tilde in “Rails~2.0” is intentional?

2008-05-11
36TYPO

In section 3.3, the first two paragraphs look completely redundant. One of them should be removed.

2008-05-11
37SUGGEST

‘Version Control’ section talks about subversion. Rails core has moved to git, so maybe git could be more prominent in the book?

2008-08-10
39SUGGEST

RadRails has been incorporated into Aptana, and radrails.org now redirects to www.aptana.com/rails

2008-05-11
44OK

“This script starts a stand-alone web server that can run our newly created Rails application under WEBrick.”

On my mac leopard machine, this runs Mongrel, not WEBrick. Don’t know what it depends on but seemed worth a mention.

(Sam says: Covered by the footnote)

2008-05-11
48OK

Screenshot reflects older version. Looks like it’s been updated to be more resource-centric.

In screenshot:
"Template is missing

Missing template script/../config/../app/views/say/hello.rhtml"

When I run it:
"Routing Error

No route matches “/say/hello” with {:method=>:get}"

2008-05-12
50SUGGEST

4th paragraph, first sentence:

“ERb is a filter that takes a .html.erb file and outputs a transformed version.”

Does the “.html” prefix need to be there?

2008-05-11
90TYPO

The book indicates we have created a stylesheet, but this doesn’t happen.

2008-05-11
131OK

paragraph : The customer is never satisfied
second sentence : […]our boring old Web 1.0 application now sports Web 2.0 AJAX speed stripes.

supports ?

2008-05-12
132ERROR

the arrow is pointing to the line:
respond_to { |format| format.js }

the arrow should be pointing to the line:
current_item = cart.add_product(product)

2008-05-11
132SUGGEST

A red arrow should be pointing to the last line of the add_product method.

2008-05-11
133ERROR

The parameters in the highlight method should be :startcolor and :endcolor, not :start_color and :end_color.

2008-05-11
135TYPO

The dangling ‘>’ is missing from the code example on this page.

2008-05-12
75TYPO

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, Rails won’t know to”

2008-08-18
150TYPO

Line numbers are not referenced in a few places in the text. i.e. the first paragraph begins with ‘On line ,’ and the second paragraph begins with ‘Next, on line ,’.

2008-05-12
150ERROR

The last paragraph states: “In the save_order action we assumed that the order object contains the method add_line_items_from_cart”, however no such method is referenced by the save_order in the previous code sample.

2008-05-12
75TYPO

hi. I something missing on this page? the 001…rb file is referenced, but no extra coding is provided. I tried to add what’s in the second edition of the book, but that too fails when it comes time to run the rake db:migrate command, which only echoes the “(in Users/….)” bit. Firing up the server afterwards to the ~/admin url begets a 500 server config error. Upon checking the db, no tables are created so I think some extra code is missing here.

Thanks.

Steve in Wisconsin

(Sam says: clarified that no modifications are necessary to this file)

2008-05-11
111ERROR

“Now hit Refresh, and you’ll see the application is running the new cart and the new add_to_cart view.”

Hitting refresh at this point gives me the following error:
“ActionController::InvalidAuthenticityToken in StoreController#add_to_cart”

which is not surprising since the refresh is causing the browser to re-post the form with what is now an invalid authenticity token.

Hitting refresh would work if the store was the last page we had viewed, but the tutorial had us click on the Add to Cart button which took us to the /store/add_to_cart page where we were confronted with the error.

I think better advice would be to “return to the Store page and hit Refresh…”

2008-05-12
94TYPO

The image of the generated index page says “Find me in …index.rhtml” but the view is actually index.html.erb.

2008-05-23
76TYPO

In the third line, just after “We created”, there is an “an” instead of “a”.

2008-05-11
101SUGGEST

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.

(Sam says: added a suggestion to add the :method option, and added a playtime activity in chapter 9 to replace this with a proper form)

2008-08-14
118SUGGEST

In the second code snippet on the page (for store_controller.rb), you give the action as a string literal (redirect_to :action => ‘index’) whereas in all the surrounding code snippets on 118 and 119, you give the action as a constant:
<%= button_to “Empty cart”, :action => :empty_cart %> (p118), and redirect_to :action => :index (p 119)

I realize that the string literal and the constant are equivalent, but for those of us new to ruby, seeing inconsistencies like this leads us to wonder if there’s some significance to using the string literal instead of the constant that we’re unaware of.

2008-05-12
141TYPO

Didn’t the book start with using sqlite3 setup, then on this page doesn’t give any information on how to enter the constraints for that database.

2008-05-12
74OK

The command, toward the bottom of the page:
ruby script/generate scaffold product \\
> title:string description:string image_url:string

Should be in crimson

(Dave says: ’fraid our syntax highlighter ain’t up to that…)

2008-09-23
108TYPO

This page introduces a method listing as though it is new code but this has already been introduced and entered on page 106

2008-05-11
142SUGGEST

The code sample and text around setting up the order model is a little confusing.

The text at the end of p 142 indicates that we should open order.rb and add a call to has_many. However, the code snippet at the bottom of p 142 also includes stuff for validation and for selection lists - neither of which have been addressed in the text at this point.

I would suggest that the code snippet at the bottom of p 142 should show the Order class having only the has_many call. Alternatively, the text could explicitly mention that the other sections of the file should be ignored for now. In this case, the commented ellipses should be removed as they make it appear that something has been left out when near as I can tell, the entire file is presented.

Also, unlike code snippets from previous sections, there is no link to the corresponding file on the web site.

2008-05-12
150TYPO

“The next line adds into this order the items that are
already stored in the cart—we’ll write the actual method to do this in a minute.”

Actually, in the referenced code snippet, the next line saves the object. I believe the referenced code snippet is missing a line with a call to add_line_items_from_cart (see also #31784)

2008-05-12
166ERROR

Create the template in the file index.rhtml.

Shouldn’t it be index.html.erb?

2008-06-04
143SUGGEST

In previous sections, code snippets usually only show the code needed so far; i.e., the code snippets show files as they would look at that point in the tutorial rather than their final state.

In this section the code snippets all seem to show the file in its final state.

2008-05-12
151ERROR

The definition of .from_cart_item in line_item.rb appears to be incorrect. In its current form, it is returning the total price; it needs to return the new line_item object.

2008-05-12
156TYPO

The command for creating the user model is truncated. One might guess at what the command should be, but it’s difficult to know what else might have been tacked on to the end of the command

2008-05-23
157TYPO

When I generate the user model on my local system, the resulting migration includes t.timestamps. The code snippet at the top of p. 157 showing the migration does not include t.timestamps

2008-05-23
168ERROR

Where is the other stuff in this file: helper :all, and protect_from_forgery :secret => ’….. ?

2008-06-04
168SUGGEST

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

2008-08-10
170ERROR

Shouldn’t the filename be admin.html.erb instead of admin.rhtml?

2008-06-04
171ERROR

list_users.rhtml should be list_users.html.erb

2008-06-04
179ERROR

Shouldn’t the rxml be xml.erb?

2008-06-04
187ERROR

I have the following in the product_test.rb file:

require File.dirname(FILE) + ‘/../test_helper’

class ProductTest < ActiveSupport::TestCase
# Replace this with your real tests.
def test_truth
assert true
end
end

has things changed?

2008-08-10
76TYPO

Let’s connect to
it. Remember, the URL we give to our browser contains both the port number
(3000) and the name of the controller in lowercase (product). => products figure show admin

2008-05-23
72SUGGEST

Under ‘Testing your configuration’, the text is still MySQL focused. This is where users who planned on using SQLite were told to turn if they were ‘going with the flow’ and using SQLite instead of MySQL. I suggest either adding SQLite configuration checking or redirecting SQLite users to wherever the SQLite instructions reside. Still reading for hte first time, so can’t tell you where that is yet, sorry…

2008-05-11
162SUGGEST

(Note that we added the admin layout to this new controller—let’s make the screen layouts consistent across all administration functions.)

While the code on the web site for login_controller.rb contains the appropriate layout “admin” statement, the text makes no mention that you need to add that line, nor does it mention anything about having to create the admin.html.erb

I would have thought that the code snippet would have included the layout “admin” statement.

2008-06-04
49TYPO

You might want to elaborate that you’ll need rhtml for older Rails versions, and that .html.erb only works with Rails 2.0.

2008-05-11
49SUGGEST

You might want to elaborate that you’ll need rhtml for older Rails versions, and that .html.erb only works with Rails 2.0.

2008-05-11
106ERROR

The add_to_cart method is displayed in a code snippet on page #106. I don’t think it should be.

On page #108 it says “This button links back to an add_to_cart action in the store controller (and we haven’t written that action yet)” and displays the method (again) a little further down the page.

So I think the mistake was including the add_to_cart method in the find_cart snippet on pages #106-107.

2008-05-11
218OK

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 a single sentence.

2008-08-14
60OK

Using Aptana and rails 2.02, -%> has same html output as %>.
html.erb of
It is now <%= Time.now %>.

It is now <%= @time %>.

produces>
It is now Fri May 02 09:18:30 –0400 2008.

It is now Fri May 02 09:18:30 –0400 2008.

html.erb of
It is now <%= Time.now -%>.

It is now <%= @time -%>.

produces>

It is now Fri May 02 09:33:39 –0400 2008.

It is now Fri May 02 09:33:39 –0400 2008.

(Sam says: when viewed through the browser, the output often appears to be the same, the difference (as explained in the text) only shows up if you view source)

2008-05-11
81ERROR

After adding the price to the model, you show that you need to modify the new.html.erb, edit.html.erb, and show.html.erb files, but not the index.html.erb file.

2008-05-11
89TYPO

The text indicates that the file list.html.erb is being edited, but in fact it is index.html.erb

2008-05-11
150ERROR

at the end of the page you said “In the save_order action we assumed that the order object contains the method
add_line_items_from_cart, so let’s implement that method now.”
but the save_order method does not contain it.

If I add by myself order.add_line_items_from_cart(cart) in save_order method I get “LineItem expected, got BigDecimal” error after pressing the “place order” button

2008-05-12
133TYPO

start_color and end_color should be startcolor and endcolor, respectively.

The line of code in the book is:
page[:current_item].visual_effect :highlight, :start_color => “#88ff88”, end_color => “#114411”

2008-05-11
39ERROR

Akin to #31725, another mention of ‘gem_server’. I have found ‘gem_server’ not to work, although ‘gem server’ works nicely.

Environment: WinXP, Ruby 1.8.6, Rails 2.0.2

2008-05-11
165SUGGEST

at top of page you suggest looking at values in database, and you show a ‘mysql’ prompt. As you have said that the database that will be used is now sqlite, shouldn’t it be sqlite?

2008-06-04
161ERROR

Shouldn’t the .rhtml ’s be .erb ’s ?

2008-05-23
164ERROR

Top of page “Download depot_r/app/views/login/add_user.rhtml”
Should this be .erb?

2008-06-04
669SUGGEST

Just wondering if these .rhtml example files should be updated to be html.erb files?

Cheers

2008-06-04
90ERROR

refers to list.html.erb file. This file does not exist, and instead is the index.html.erb file (I think).

2008-05-11
132TYPO

Yellow arrow for depot_m/app/controllers/store_controller.rb
is current on line: respond_to { |format| format.js }
should be on line: current_item = cart.add_product(product)

2008-05-11
162ERROR

From here on, the book talks about an admin layout/controller, which seems to be the products controller created earlier in the book.

2008-06-04
135TYPO

The three helper method files at this point are application_helper.rb, products_helper.rb and store_helper.rb

2008-05-12
133ERROR

The symbols for the “highlight” visual effect are incorrect; they should be :startcolor and :endcolor rather than :start_color and :end_color.

2008-05-11
69TYPO

mysqladmin -u root create depot_development

2008-05-11
659ERROR

NoMethodError (undefined method `paginate’ for #<AdminController

with: product_pages, products = paginate :products, :per_page => 10
or: product_pages, products = paginate(:products, :per_page => 10)
maybe it needs a plugin ?

2008-08-10
51SUGGEST

At after the <% 3.times do %> in the example near the top of the page, there’s the HTML comment “” - and I’m really not sure what that’s there for. Is that supposed to be there? If so, some explanation should probably be listed nearby.

(Dave says: a misconfiguration in the utility that embeds external source into the book. SHould be fixed in the next beta.)

2008-05-12
85TYPO

Regexp should be…

%r{\\.(gif|jpg|png)$}i

… note the escaped dot. Without it myimagejpg would match even though it’s not a valid filename.

2008-05-11
80TYPO

“To give you a simple, no-frills inline tutorial that you
can learn from by tweak, change, and extend.” Should probably be “…you can learn from by tweakING, changING, and extendING”. I don’t think the current version is grammatically correct.

Also, on a personal note, while I’m willing to accept that the dynamic scaffolding was more curse than blessing, I’m not too convinced by the argument as-is. Maybe a few more details or a short anecdote would help?

(Sam says: Grammar corrected; argument left as is (per DHH))

2008-05-11
82TYPO

“… and you waste far less time in rework.” is grammatically incorrect. It should probably be something like “…and you waste far less time reworking your application” or “…and you waste far less time.”

2008-05-11
85OK

Is there a reason you check to see if price is nil or not in the price_must_be_at_least_a_cent method instead of adding it to the list of things to check for in the validates_presence_of line? If so, what is it?

(Sam says: validates_presence_of simply checks for blank)

2008-05-11
88SUGGEST

Is there a reason so much of page 88 is empty? I don’t see any reason why some of the material from p. 89 can’t be included there.

2008-05-11
89TYPO

In index.html.erb, the price is not listed - it goes straight from the description to the actions (and after we went to all that trouble to add the price! ;) )

2008-06-04
90OK

“(Also, see the sidebar on this page for some scoop
on this action.)” — “for some scoop” sounds really funny. How about “for some extra information?” or “for the inside scoop on this action?”

(Sam says: yes, the language is quirky, but I’m inclined to leave it)

2008-05-11
91ERROR

I thought auto-pagination had been removed in Rails 2.0? At the very least, I tried entering more than 10 items and it didn’t paginate as the text says.

2008-05-11
69TYPO

“SQLite3 there are no steps required to to create a database,” in the second paragraph.
Duplicate “to”.

2008-05-11
132TYPO

The arrow should highlight the line before the last one.

2008-05-11
645OK

a ||= b
The assignment statement supports a set of shortcuts: a op= b is the
same as a = a op b. This works for most operators.

Is “op” supposed to be “or?”

(Dave says: ‘op’ is an operator, so a = a + b is the same as a += b)

2008-05-12
92TYPO

wrong link:
ink: (You’ll find hints at wiki.pragprog.com/cgi-bin/wiki.cgi/RailsPlayTime)

Is incorrect
Should be:
pragprog.wikidot.com/start

2008-05-11
69TYPO

“You may, of course, chose a different database, but
the same basic steps apply to all of the databases that Rails supports. ”

chose => choose

2008-05-11
73TYPO

“We need to create a database table and a Rails model that lets our application use that table, a number if views to make up the user inter face, and a controller to orchestrate the
application. ”

a number “if” views => a number OF views

2008-05-11
70TYPO

using Mac OS X 10.5 with rails, creating
rails —database mysql depot
does not equate to
database: depot_mysql_development
in database.yml, instead database.yml has
database: depot_development

database: depot_test

database: depot_production

2008-05-11
70OK

Could you also mention socket connections? Typical Mac OS X dev platform for many users is MAMP, which uses sockets instead of host. Maybe this is outside the scope of the document.

(Sam says: described on the next page)

2008-08-14
77TYPO

Two images have URL ending /admin instead of /products

2008-05-23
78TYPO

after ruby script/generate migration add_price_to_product price:decimal
instead of output showing
create db/migrate/002_add_price.rb
it should read as
create db/migrate/002_add_price_to_product.rb

2008-05-11
83TYPO

Image has URL ending /admin instead of /products

2008-05-23
99ERROR

We’re adding the button that calls the method add_to_cart but the method doesn’t exist yet so the result is a NameError in Store.

2008-05-12
76TYPO

The url in the graphic has a controller name of ‘admin’, when it should be ‘product’

2008-05-23
77TYPO

‘Click the Create button, and you should see the new product in the list.’ -> when you click the create button you go to the display for the newly created product, not the listing of all products.

2008-05-11
79SUGGEST

You don’t mention updating the index.html.erb file, so if you are on the listing page when you refresh after changing the new/edit/show views, the price column doesn’t appear. This is confusing if you aren’t expecting it.

2008-05-11
87OK

“Note also that, because it uses Rails’ create method, it will fail silently if records cannot be inserted due to validation errors.” -> This note would be clearer if you had already explained the methods available on models, and their relationship to validation. Alternatively, link somewhere that does explain that.

2008-08-14
91TYPO

The supplied CSS (from the website link) leaves the action links in a horizontal row, rather than a column as in your screenshot.

(Sam says:br elements added to app/views/products/index.html.erb)

2008-05-12
91TYPO

The url in the screenshot should be ../products rather than …/admin/list

2008-05-23
93SUGGEST

‘We’ve already created the Products controller…’ -> describe why the previous script/generate (page 74) was ‘scaffolding’ whereas this is ‘controller’ with a short note as to the difference and hence when to use each one.

2008-05-12
95SUGGEST

Describe the relationship between <%= h(…) %> and <h …>, the latter form being the one used in the example code prior to this.

(Sam says: changed to consistently use the latter form)

2008-05-12
98OK

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 :)

(Dave says: according to photoshop, the png background is 153/204/153, or 99/cc/99 in hex. The CSS seems to be correct—it says #9c9)

2008-12-31
151ERROR

When I finished the depot application to this point the cart_items are not placed in the line_items table when an order is placed. I downloaded the source code and tried it but that did not work either. I am using Kubuntu 8.04 and sqlite3

2008-05-12
36TYPO

Repetition / Same thing said twice:
‘osx10.5/leopard comes with R1.2.6 and can be upgraded like so…’

"And OSX 10.5 includes Rails itself. However, this is Rails1.2.6.
You’ll need to update this this to Rails~2.0 using:

Unfortunately, the version of Rails that shipped with Leopard was Rails version 1.2.6, the latest stable release at the time Leopard shipped. Fortunately, you can update your installation with a few simple commands:"

2008-05-11
136OK

Download link for Store.html.erb is not suitable.

(Sam says: need more information on what is the issue)

2008-05-28
106SUGGEST

I agree that the way the code is displayed is a little confusing — my main problem with this page is that the code you’re supposed to pay attention to is broken across 2 pages, when I think it should be in one easy to read block. I was also confused by whether you were suggesting to actually use the first piece of find_cart code or not.

2008-05-11
106SUGGEST

You introduce a local variable (product) in the code snippet, yet do not previously (or really, anywhere in this book) explain what a local variable is as compared to an instance variable (e.g., its scope). It would be good to, I think.

2008-05-12
74ERROR

“title:string description:string image_url:string” (near bottom of page)

I believe description:text is used throughout the rest of the chapter. For examples, a textarea appears in your screenshots. In addition, the sample content you provided cannot fit in a string datatype.

2008-05-11
108TYPO

“This button links back to an add_to_cart action in the store controller (and
we haven’t written that action yet)” -> actually, we have already written that method. A previous erratum noted the duplicated listing of the method.

2008-05-12
76OK

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 line is in blue, with everything after the #start is in green. Looks like some sort of auto-coloration script/algorithm gone awry.

(Dave says: yeah, our syntax highlighting can get confused by this kind of thing…)

2008-08-18
112OK

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 and build it the right way. Then when I finish that section I see the bad things that can happen if you store lots of stuff in the session, and then how exactly to do it the right way, so I can concretely see the benefits over the bad way.

2008-08-14
109SUGGEST

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 title to a div called “cart-title” on page 119, but I think it’s semantically an h2 both times.

2008-08-14
84TYPO

Looks like a space crept in between the dot and the method name in “ActiveRecord::Base. validate”

2008-05-11
87TYPO

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.

2008-12-31
98OK

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 books line up wrong if the descriptions are too short (they’ll be okay if you go with the default ones, but this seems like a pretty big weakness)… I realize this is a book about web programming, not site graphic design, but if this could be fixed, that’d be great.

(Sam says: the images should match, as the screenshots were generated from the code)

2008-08-10
113ERROR

In footnote 6 you refer to MySQL usage, but we are using SQLite. I believe this is just a minor oversight from the 2nd edition.

2008-05-11
106SUGGEST

I agree that putting the code one one page would be better - or, at the minimum, don’t put “private” at the very bottom of the previous page and the private method on the next. That makes it very easy to miss, and then the paragraph explaining what private does can be confusing.

2008-05-11
110OK

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(product) ). I left them off (was trying to further the habit of not using parenthesis all the time in Ruby) and this causes the following error:

/rails/depot/app/models/cart.rb:13: syntax error, unexpected tIDENTIFIER, expecting kEND

I’m guessing that the issues is that without the parenthesis the binding gets messed up. Might be worth mentioning, as it took me quite a while to figure out what I had messed up… after the fix, the server might need to be restarted and the sessions cleared too (I had to do this the first time, but oddly enough, not after trying to replicate the error).

2008-12-26
133ERROR

After I add the :highlight visual effect, if I click on the Add to Cart button for a book that is not already in the cart, I get the following popup: “RJS error: TypeError: $(”current_item“) has not properties.”

This is followed by a large popup outlining an Element.update() statement followed by a $(“current_item”).visualEffect(…) call.

(Sam says: added arrows to highlight changed lines)

2008-05-13
110OK

I got a ‘uninitialized constant Cart::CartItem)’ error, which took me quite a while to figure out. It was obviously a class loading problem, but I couldn’t figure out why. Turns out I had put my CartItem class in a file called CartItem.rb, rather than cart_item.rb.

This is the first place that this error might occur in the book, so I think a callout might be a good idea.

2008-12-26
50OK

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.html.erb’ fails, but renaming the file to ‘hello.rhtml’ works fine. Not sure what could cause this. Note: I installed Rails based on the book instructions.

(Dave says: sound like you;re running the wrong Rails)

2008-08-10
141OK

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

(sam sys: That won’t create the database level constraint, which is the point of the exercise.)

2008-08-14
149ERROR

Missing line from store_controller.rb:
order = Order.new(params[:order])) order.add_line_items_from_cart(@cart)

2008-05-12
147SUGGEST

Why not use the label form helper? Examples:

<%= label :order, :name %>
<%= label :order, :pay_type, “Pay with:” %>

2008-06-04
133TYPO

page[:current_item].visual_effect :highlight,
:start_color => “#88ff88”,
:end_color => “#114411”

Error Description:
:start_color should be :startcolor
:end_color should be :endcolor

These are the bindings of ruby to the scriptaculous library for the highlight visual effect.

2008-05-11
132SUGGEST

The code changes in cart.rb for returning the current_item are not pointed out.

Since the code changes are not outlined in the above mentioned code, some readers miss it and then run into an RJS error when performing the AJAX postback. (add_to_cart in Store controller does not receive a reference to the current item, therefore it cannot mark an item as the current_item when rendering the partial) since they did not make the needed change.

Also the code listing of store_controller#add_to_cart points out the wrong line as the changed line.

2008-05-11
146ERROR

Checkout template should be checkout.html.erb instead of checkout.rhtml.

2008-05-12
119TYPO

I just struck me here, but it applies for everything up until this page: there has been inconsistent use of <h …> and <%= h(…) %>. I guess those are equivalent, but it hasn’t been explained that way yet.

(Sam says: ixed these, will continue to fix as I go)

2008-05-12
118SUGGEST

On p. 118, we use redirect_to like this:

redirect_to :action => ‘index’

And back on p. 115, we used it like this:

redirect_to :action => :index

Is there any reason to use a symbol over a string (or vice-versa)?

2008-05-12
151ERROR

Instructions are given on how to view the order in a MySQL database, but this application was set up to use a SQLite database and no instructions are given how to view this. If the first line is replaced by “sqlite3 db/development.sqlite3” then the rest can be typed in as given. Use “.quit” or “.exit” to exit SQLite.

2008-05-12
160ERROR

A new method, “after_destroy”, has been introduced into this listing without any explanation.

2008-05-23
151ERROR

There does not seem to be any method to save a line item.

I assume that the item should be saved if the @order.save call is successful but being a total newbie I am not yet clear on the best way of implementing this.

I think this is an area of relational database handling that really needs explanation especially after such an excellent description of how foreign key relationships behave on the previous pages.

This totally superb book gave me the confidence to try to find a solution but I have yet to find one that does not completely lock the database and cause internal server error 500 pages to be displayed after submitting the order.

So could this please be covered in a future revision.

Thanks

2008-05-12
133TYPO

the options for hightlight are:
startcolor
endcolor

and not:
start_color
end_color

2008-05-12
73TYPO

In the first paragraph of “Create the Products Database and Maintenance Application”, it reads “a number if views”. Should this be “a number of views”?

2008-05-12
164OK

I believe that the fieldset and legend tags should be inside the form tags.

2008-08-10
132SUGGEST

The store_controller.rb listing uses an arrow to show the changed line but the cart.rb listing doesn’t. It would be good to have consistent use of this throughout the text.

(Sam says: ruly is a judgment call on each case; that being said, this particular fragment has proven to be problematic, and has been fixed)

2008-05-13
76TYPO

we are supposed to browse to the localhost port 3000 / controller name(product) but in order to see a listing I had to browse to products. this is standard I know now, but only becaus eI brosed around the internet the image was also not helpful see related case #31908.

2008-05-23
34ERROR

What about pagination plug-ins?

2008-08-10
141ERROR

The ALTER TABLE statements fail here with SQLite3 as the DB. Perhaps these were appropriate for MySQL in an earlier version but were not updates??

2008-05-23
40TYPO

Last paragraph:
“If you installed our own copy of Ruby”
“our” should probably be “your”

2008-05-23
80TYPO

Line 2 inside the bubble; word “could” appears twice.
“From a single line in the controller, you could could

2008-05-23
117OK

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 screenshot). But for some reason there is no border shown in Opera (or in fact any obvious styling).

Not sure if you want to fix this or not as it’s hardly the point of this tutorial but it might be helpful to mention that Opera displays differently to avoid confusing people.

2008-08-10
83OK

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 still show the file and what it will look like. OK looking ahead I see on page 86 you do that. Then you should say that a number of changes are going to be made to app/models/product.rb and the final result will be shown on pg. 86.

Second suggestion: Make “Download foo” font larger.
The “Download foo” shwon in SMALL type and with a GRAY background is hard to read on the screen. Probably fine in printed book. I’m following along in my app and want to look at the existing file.

2008-08-14
91ERROR

In addition to the wrong url mentions, the product listing is showing

and tags which I think means that the 003_add_test_data is wrong. Some rethinking of how to get HTML formatting through %{ is needed. It’s not just the fig. that wrong. I’m running the tutorial and the tags show.

2008-05-23
238TYPO

Sidebar has GEM = 2.0, text says 1.2

2008-06-04
94TYPO

The footnote that describes the routing error says, “… message saying, ‘no route found to match…’” Actual error message is ‘No route matches…’

2008-05-23
35SUGGEST

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 release - making new funny things not descriped in the book.
See page 36, 40 (rails 2.0.2 dummy_app), 43, … also.

2008-08-14
232OK

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:”

2008-08-14
285TYPO

URL to plugin does not work.

maybe this is correct:
repo.pragprog.com/svn/Public/plugins/annotate_models/

2008-06-04
410OK

Under Controller Naming (or Named Routes above), I’d also like to see a quick example showing a named route using a moduled controller.

2008-08-14
38SUGGEST

In the editor list, I think it has to include Netbeans 6.1 too.
Has a great Ruby/Rails support.
P.D.: The book is awesome! :D

2008-05-28
238TYPO

“You can tell Rails to use a particular version of itself by adding a line like
RAILS_GEM_VERSION = ”2.0"
……. Rails will query the installed gems on your system and arrange to load
the correct one (1.2 in this case)."

Should be (version 2.0 in this case).

2008-06-04
50TYPO

Figure 4.4 shows “hello.rhtml” instead of “hello.html.erb” witin the say/ directory.

2008-05-23
161TYPO

The output from the “ruby script/generate…” command should have “.html.erb” extension and not the older “.rhtml” extension.

2008-05-23
163TYPO

First sentence in last paragraph: “To get this action to do anything useful, we’ll need to create a view for it. This
is the template add_user.rhtml in app/views/login.” should read “To get this action to do anything useful, we’ll need to create a view for it. This
is the template add_user.html.erb in app/views/login.”

2008-06-04
169TYPO

First paragraph in Section 11.4: “A layout for the admin controller would
be in the file admin.rhtml in the app/views/layouts directory.” should read “A layout for the admin controller would
be in the file admin.html.erb in the app/views/layouts directory.”

2008-06-04
48OK

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 the correct browser display.
OS X 10.4.11 with uptodate rails (2.0.2) per pg 35

(Sam says: this is a non-deterministic bug in Rails. DHH is aware)

2009-02-13
0OK

Doesn’t include enough information on the Seaside framework, despite the cover.

(Dave says: full Seaside documentation is included in the fnords)

2008-05-23
150OK

There is no call to “add_line_items_from_cart” anywhere in the project (grep -r shows nothing).

(Sam says:page 149, app/controllers/store_controller.rb, save_order line 4)

2008-05-23
152OK

The output format for the SELECT statements in SQLite3 requires “.mode line” to be set first, otherwise SQLite appears to default to “.mode list”.

Sam says: -line command line argument specified)

2008-05-23
38SUGGEST

Maybe you should also mention XCode on Leopard

2008-08-14
51OK

strange! I’m not getting the blank lines at all with
<% 3.times do %>
Ho!

<% end %>
Merry Christmas!

(Sam says: when viewed through the browser, the output often appears to be the same, the difference (as explained in the text) only shows up if you view source)

2008-05-28
79TYPO

an additional field is added by ruby script/generate ad_price_to_product but when rake db:migrate is run again the output doesn’t match 2 AddPrice should be 2 AddPriceToProduct

2008-05-23
115OK

when i put //localhost:3000/store/add_to_cart/wibble in the browser nothing is returned
i’m sinply back to //localhost:3000/store/

(Sam says: Wibble doesn’t produce an error? Does for me, reproducibly…)

2008-08-10
167ERROR

depot_r/app/views/login/index.rhtml is incorrect, should display Welcome, with date and time, and the order count.

Also index.html.erb is the correct name

2008-06-04
277TYPO

It seems odd that we are defining the new users table with a migration called ‘add_price_column’.

2008-06-04
658TYPO

Seems like you have an unresolved conflict from CVS/Subversion in your code listing for 005_create_orders.rb

2008-06-04
111OK

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 server was enough to clear the sessions. Hmmm, let me think, if session information is kept in the database then the database needs to know which session to look up so I guess the browser has the session ID stored & sends it again so restarting the server has no effect unless you run the above command. If this is not the case then some mention of what is happening might round out your lesson.

2008-08-14
161TYPO

On page 161 the controller Login is generated. Later in the book this controller is referred to as Admin. Additionally, login is an action within the login controller - creating some confusion (at least for me.)

2008-05-23
86SUGGEST

‘or PNG image\\.(gif|jpg|png)’

This part doesn’t seem like it should have ‘\\.(gif|jpg|png)’. It looks weird.

2008-05-23
79TYPO

Price

2008-05-23
169TYPO

There is no previous mention of admin_controller.rb

admin/list is not valid either

2008-06-04
42TYPO

Fifth line from top:
… and RubyGems will automatically update your Rails installation.6. => Remove extra period.

2008-05-23
50TYPO

Eighth line from top:
ERb is a filter that takes a ..erb file => Remove extra dot.

2008-05-23
37SUGGEST

“It’s simple insurance against you accidentally breaking stuff when you make a change.”

Actually, CI doesn’t prevent you from breaking anything, it just notifies you really quickly when you do, right? I suggest changing the wording. For example, something like:

“CI’s nearly instantaneous error notification minimizes the damage when a programmer accidentally checks in code that fails the tests.”

2008-06-04
39TYPO

“If you want to connect to a database other than SQLite3. Rails also…”:

I think you wanted a comma after SQLite3, no?

2008-05-23
164SUGGEST

Your screenshot of the add user form is quite pretty, and I’m sure reflects the styling of the “depot-form” styling of the div, but unless I’m missing something, nowhere in the view code do you import the CSS to apply said styling.

2008-06-04
165TYPO

The heading for the last listing shows a file name of “login.rhtml” instead of “login.html.erb”.

2008-06-04
167TYPO

Truncated code on line 7 of first listing. Should presumably be as /store/index.html.erb, i.e. “<% form_remote_tag :url => { :action => :add_to_cart, :id => product } do %>”

2008-06-04
167TYPO

Ignore my above correction as this appears to be completely the wrong listing and would never produce the screen on the following page even when the truncated code is corrected and something is made up to avoid the ‘nil object’ error. It is simply an incomplete copy of the store/index.html.erb file. The same incorrect file appears in the code archive.

2008-06-04
33TYPO

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

(Sam says: Book has been updated to describe instant rails 2.0)

2008-08-14
52ERROR

Substituting %> for -%> do not remover the line breaks in the generated html code for me.
Mac OSX 10.5.2, RubyOnRails 2.0.2

2008-05-28
48OK

I get a slightly different error message to the one displayed in the screen shot: “Unknown action. No action responded to hello”

(Sam says: That would mean that you didn’t add the hello method to the say controller)

2008-05-28
21SUGGEST

Use gem server instead of gem_server

2008-05-23
248TYPO

Note 3 at the bottom of the page reads ‘3. You need to install ruby-debug to run the server in debugging mode. With gems, use’.
Needs deleting or completing

2008-06-04
80SUGGEST

“You’ll need to either rerun the scaffold …”

How do you rerun the scaffold?

2008-05-23
79TYPO

Misspelling: “subtly”, not “subtlely”.

Use a semicolon after “at the moment”, not a comma.

2008-05-23
168TYPO

it seams like the filter “before_filter :authorize” should not be addet to admin_controller.rb but to products_controller.rb

2008-06-04
180TYPO

This may be reported elsewhere but shouldn’t .builder be used instead of .rxml since .rxml will be deprecated in rails 3.0?

2008-06-04
77TYPO

First line:
Click the Create button, and the you should see… => Remove second “the”

2008-05-23
189TYPO

My generated unit test does not include the fixtures :products line.

2008-08-10
69SUGGEST

“Create the Products Database and Maintenance Application” at pdf page 73 should probably have its own section number. Currently the cross reference at pdf page 69 points to “Section 6.1, Create the Products Database and Maintenance
Application, on page 73” while section 6.1 in reality starts at pdf page 68.

2008-06-04
92TYPO

Second line from bottom:

  • Add the product price to the output of the list action. => There is no “list” action.

(On a related note, the depot.css file refers to “admin/list” as well.)

2008-05-23
77OK

First paragraph of section 6.2 starts with:
“So, we show our scaffold-generated code to our customer…”
but we’ve not used a generate scaffold script. Looks like a leftover from the 2nd edition.

(Same says: page 74)

2008-05-23
75SUGGEST

Last Paragraph on this page, parenthetical statement:
(How does rake know…? You’ll find a table called schema_info that it uses to keep track of the version number.)
As a newbie to Rails, v.20+ and SQLite3, it would be helpful to have a side bar on simple SQLite3 commands as to how to do this.

2008-06-04
52OK

Noticed that if I copy the code out of the PDF (viewing in Preview on Mac), there are blank spaces before the end-of-line, and the line breaks are not removed. Deleting the spaces in the editor gives the expected behaviour.

(Dave says: this is a side effect of the microspacing we use (The books are formatted by TeX). I suggest using the downlaods, and not copying out of the PDF)

2008-05-23
48ERROR

in the browser screenshot it should say….hello.html.erb these days..

2008-05-28
135TYPO

It is:

… %>

shouldn’t it be?

<div id=“cart” ….. %>>

2008-05-28
87ERROR

The link to download the set of images:

media.pragprog.com/titles/rails3/code/depot_c/public/images/

is producing the following error:

Application error

Rails application failed to start properly
2008-06-04
136OK

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 explanation as to why a string is used vs. a symbol?

2008-08-14
137OK

I’m not 100 percent sure but wouldn’t the title “Downgrading If Javascript is Disabled” be more appropriate?

2008-08-10
41ERROR

To install SQLite using RubyGems, it seems that ‘sqlite3-ruby’ is required rather than ‘sqlite’ as mentioned in the book. (Using ‘sqlite’, a Makefile could not be created in Windows.)

2008-06-04
38SUGGEST

It seems that NetBeans is nowadays a very popular (and free!) IDE for Rails development. Most of the editors listed are commercial only, and it would be nice to exhibit more budget options.

2008-06-04
41OK

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 download sqlite3.dll from the SQLite site and place it in your path (e.g. /rails/bin/). Otherwise, the rails web app will return a very unhelpful “Unknown error.”

(Sam says: Went with InstantRails 2.0 instead)

2008-08-14
48TYPO

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

2008-08-18
55SUGGEST

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 reading the box a waste of time), some readers (such as myself) want a more advanced understanding of how this works.

(Dave says: understanding will come, but not at this point in the book. And magicians never tell…)

2008-08-10
64OK

In the last paragraph, you only refer to the seller as “her.” Should be “his” or “his/her” to be PC.

(Dave says: That would be true if we didn’t know who the seller was. But in this case we know her…)

2008-05-28
73TYPO

In first full point on the page, you list “Mysql” twice — should be “MySQL” to be consistent with the rest of the text.

(Sam says: The first occurrence left as is to match the error message produced)

2008-06-04
69OK

You say that if we are using SQLite3, we can skip to Section 6.1. However, we should change the database used from the default (in the .yml file) to something specific to our depot application.

(Sam says: renaming is not required)

2008-06-04
70OK

Explaining why the default uses “db/” and yours uses “” may be helpful. Is it advantageous to use “db/…”? Is it required for SQLite3?

(Same says: In both cases, it IS the default; it’s just that the default varies by database type)

2008-06-04
78TYPO

Before the last code sample on the page, should you change “:precision, scale, and default arguments” to “:precision, :scale, and :default arguments”?

2008-06-04
86TYPO

In both code samples, “\\.” should be replaced just by “.”, without the backslash. The HTML rendered contains the backslash; it is not interpreted as an escape character!

2008-06-04
82ERROR

In the app/views/products/show.html.erb module, you have used the h method to strip HTML escape chars as follows:

Description:
<h @product.description>

In your first product example you include the

paragraph tag. If HTML formatting is valid in the description field, then no h function should be used.

2008-08-14
79ERROR

If HTML is to be allowed in the description field, then the h method should not be used in the index.html.erb file.

2008-08-14
150TYPO

Twelfth line from bottom:
“…each new line item to the line_items collection on line hands the responsibility…” => missing line number? (“…on line 4 hands…”). If this is the case, then add_line_items_from_cart needs line numbers.

2008-08-14
91TYPO

The screenshot shows the header “Product Listing”, while the source code shown produces a screenshot the has a heading of “Listing Products”. Change the source code or change the screenshot.

2008-08-10
81TYPO

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

2008-08-10
169ERROR

the before_filter should be added into the store_controller.rb rather then in the (non-existent) admin_controller.rb

2008-06-04
169ERROR
  • sorry, it has to be in the products_controller.rb not in the store_contoller.rb and not the admin_contoller
2008-06-04
78TYPO

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 prices such as 10.012 and they will appear with all three decimal places showing. The code in the migration appears to be correct:

def self.up
add_column :products, :price, :decimal,
:precision => 8, :scale => 2, :default => 0
end

I am using sqlite3 version 3.5.9, Rails 2.0.2, ruby 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.10.0], Mac OS 10.4.11.

I imagine it is my mistake, but for the life of me I can’t figure out where I’m making it.

(sam says: added a warning)

2008-08-18
156SUGGEST

On the line that gives the command to generate the new user model, the line is truncated, cutting off the last part with a “Missing Code truncated” message. In reading the code segment on the following page, we can figure out that the column is of type string, but it would be simpler to see that in the command line on page 156

2008-06-04
157ERROR

code listed in the text at the top of page 157 reads:

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.column :name,                        :string
      t.column :hashed_password,  :string
      t.column :salt,                           :string
    end
  end

  def self.down
    drop_table :users
  end
end


but code generated by Rails (and in the corresponding file from the link in the pdf) is:

class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string :name
      t.string :hashed_password
      t.string :salt

      t.timestamps
    end
  end

  def self.down
    drop_table :users
  end
end
2008-06-04
161TYPO

The output generated by the generate controller script on page 161 shows a number of .rhtml files whereas the files produced are actually .html.erb files

2008-06-04
164ERROR

The link to download the code segment:
Download depot_r/app/views/add_user.rhtml
produces a file not found error.
When I edit the URL to reference add_user.html.erb, it too produces a file not found error.

2008-06-04
164ERROR

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 CSS and other page information in. (to fix, I ended up cobbling together one from the layout for the store, removing store specific code).

2008-08-10
354OK

Error is really probably a typo - cut and paste without required modification.

In polymorphism section, subclasses inherit from ActiveRecord::base directly instead of the new superclass “CatalogEntry”. Subclassing doesn’t work if classes are defined as written, but does if Article, Sound, etc., inherit from CatalogEntry.

Great book by the way. Thanks for the rails 2 update.

Cheers
Wayne

(Sam says: Not true: the code works as is. Futhermore these classes aren’t CatalogEntries, instead they have a relationship with CatalogEntry. I did, however, add a sentence to highlight this.)

2008-06-04
136OK

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 to an empty cart; however, the flickering is still happening.
I’ll move on in the tutorial and come back to this later when my understanding is a little more complete; perhaps I’m missing something.

2008-08-10
78ERROR

“Listing products” image has Price column, but we haven’t added it yet to the application at this point in the book.

2008-08-10
92ERROR

The “Listing products” image shouldn’t contain HTML markup in the description since we removed it using product.description.gsub(/<.*?>/,’’).

2008-08-10
132OK

We changed a handful of lines of code, and our boring old Web 1.0 application now sports Web 2.0 AJAX speed stripes.

supports (not sports)

(Sam says: I prefer the original colloquial language)

2008-06-04
167SUGGEST

Code for the /app/views/login/index.html.erb file

This from the 2nd edition of the book, may help folks move forward…

  <h1>Welcome</h1>
  It's <%= Time.now %>
  We have <%= pluralize(@total_orders, "order") %>.
2008-06-04
76ERROR

Missing: creation of admin_controller.rb — used on page 169

In the 2nd edition (printed version) of the book, there are instructions in chapter 6 “Create Your Controller” (page 67) that describes the creation of the admin_controller.rb file. This has been omitted in the 3rd edition. However on page 169 of the 3rd edition PDF file, there is a reference to edits to be made to the admin_controller.rb file (which doesn’t exist if you follow the examples in making the depot application). I think the section in Chap 6 may have been omitted for its use of the scaffold :product command, but there should be some mention either here or around page 169 of making the admin_controller.rb file.

2008-06-04
169OK

Re: missing admin_controller.rb
(See also the erratum #32215 for page 76)

in comparing the text of the 3rd edition to the 2nd ed printed version, it looks like there was a section in Chapter 6, that has been omitted (subheading was “Create Your Controller”), which takes care of setting up this admin_controller. I don’t know if this is deliberate due to changes in Rails since the 2nd edition, or if parts of that section were cut that should have been kept.

For what it’s worth, based on the 2nd edition, I tried this and it seems to work:

create a new admin controller:
ruby script/generate controller admin

this creates the new admin_controller.rb in the app/controllers directory
You may need to restart your webserver for this to work properly.
Add in the before_filter as described in the edition 3 PDF. It seems to function correctly as far as I can tell.

Note that the 2nd edition had instructions to include “scaffold :product” in the admin_controller.rb file. I tried this but it produced an error. I’m guessing this changed for the new Rails version which is why the rewrote that section of Chapter 6.

(sam says: admin controller now created in section 11.2)

2008-06-04
134OK

In the second line after the _cart_item.html.erb, the id has to different types of quotes

(Sam says: I see double quotes consistently throughout this example)

2008-06-04
136ERROR

In the second line after the extract of “ls -p app/helpers”, the controllers should be “product and store” instead of “admin and store”.

2008-06-04
173ERROR

Sixth line from top:
… link_to ‘Orders’, :controller => ‘orders’ … => I don’t recall an ‘orders’ controller being generated earlier (only a model was generated).

2008-08-10
170SUGGEST

Fifteenth line from bottom:
“before_filter :find_cart, :except => :empty_cart” => This line isn’t related to the authorization and probably shouldn’t be introduced yet.

2008-06-04
172TYPO

Twentieth line from top:
“…and have them only show up if there is a :user_id in the session. now.” => Move “only” and remove “. now.”:

“…and have them show up only if there is a :user_id in the session.”

2008-06-04
172SUGGEST

Seventh line from bottom:

The "if cart" conditional should also be highlighted as as new code and perhaps described in the text. (The conditional is important because without it, any controllers that don't create a cart will cause an error when rendering their views.)

2008-06-04
166SUGGEST

First line:
“We’ll need a controller to support for a login action in the login controller,” => “We’ll need a controller to support a login action,”

2008-06-04
166SUGGEST

Seventeenth line from bottom:
“flash.now[:notice] = …” => An explanation of “flash.now” as well as why it is used rather than just “flash” may be helpful.

2008-08-14
165SUGGEST

Fifteenth line from bottom:
“sqlite3 —column db/development …” => add “depot> ” command prompt and the sqlite3 command itself should probably be red, for consistency. Also, the output appears to be in -line format (not -column).

2008-06-04
155OK

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 the catalog.

(Sam says: empty cart does do a redirect to catalog)

2008-08-14
419SUGGEST

The second sentence in the paragraph starting “Several of the routes are named” confused me. I think this was because of the word “actions” (a pretty overloaded term).

Suggest re-wording to something like:

“And each of the routes support two URL forms for a given HTTP method: one with a default format, and one with an explicit format.”

(Same says: Two routes are defined for each controller action". Multiple controller actions may map onto the same HTTP method.)

2008-06-04
323ERROR

%w[ first_name, first ] must be %w[ first_name first ]

(i.e. no comma after first_name)

Same for next two lines

2008-06-04
180ERROR

There is no use of :through in the code snippet shown.

2008-06-04
185TYPO

map.connect ‘:controller/:action/:id.:format’

is not highlighted as it says in the previous paragraph.

2008-06-04
2OK

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 Linux 8.04 - Ruby 1.8.6 - Rails 2.0.2 but that command doesn’t print the Rails version. It just print this:

andy80@noteboontu:~$ rails -v
getopt: invalid option — v
Terminating…

I also tried with -V, —v, —V but nothing to do.

(Sam says: works for me: on windows, mac osx, and ubuntu)

2008-08-14
20OK

I think in the section “David says…” there should be an “s” after “particular aspect”.

2008-08-10
656OK

‘running gem server and’ must be ‘running gem_server and’

(Sam says: As of rubygems 0.9.5, gem_server was renamed gem server (two words).)

2008-06-04
52TYPO

Nothing major, never-the-less still an error. Better to correct it now.

Hypothetical template time result and browser time result don’t match.
The template says “May 23rd” where as the browser says “May 07.”
See below for the snippet.

PS: Leave May 23rd in the example as it’s my birthday. :-)

"
When you refresh your browser, the template will generate the following HTML.

  • Addition: 3

  • Concatenation: cowboy

  • Time in one hour: Fri May 23 14:30:32 –0400 2008

In the browser window, you’ll see something like the following.
• Addition: 3
• Concatenation: cowboy
• Time in one hour: Sun May 07 16:06:43 CDT 2006
"

2008-08-14
95TYPO

Third line on the page: one “a” too many:

we’ve asked it to create a just a controller

2008-06-04
90SUGGEST

Just to clean up the HTML a bit, and separate presentation from content a little better, instead of

Put in for HTML:

And then in the CSS:

table { border-collapse: collapse; padding: 5px; }

Which does the same thing as the attributes in your table tag, and add to existing style declarations for classes list-line-odd and list-line-even in your stylesheet:

.list-line-odd, .list-line-even { vertical-align: top; }

(and you can remove the valign attribute in the tr tag). You could, optionally, move the "width=60" attribute over to the stylesheet too, but what I’d do (just to save on code), is use the class “list-actions” and declare that as width=40 in your stylesheet, just so that you don’t have to declare a new class.

Also, for the title/description pairing, instead of using a on the title, it might be a little more semantic/accessible to use a definition list

, and to pair the title

and the description

with each other. That’s the way I would do it if I were creating the site for a client, but it’s more a matter of personal style rather than a better way to do it.

Feel free to contact me if you have any questions: jonathan.lane@gmail.com

…why not use an image_tag?:

If I change the migration code to:
:image_url => ‘svn.jpg’,

everything works and the image appears in the browser.

Note that I am totally new to rails, and pretty new to ruby. What I know about rails ends pretty much on page 89 of your book. Also, I am running on windows using cygwin, ruby version 1.8.7, and rails 2.1.

H^2

Never before had you used () with “h”

2008-08-14
145OK

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 would have the Ajax version at this point.

(Sam says: Iteration D4 says “So let’s not use this code” and describes a change to store.html.erb instead)

2008-08-14
153TYPO

A first attempt to hide the flash might involve adding the following line to
add_to_cart.rjs

should be

A first attempt to hide the flash might involve adding the following line to
add_to_cart.js.rjs

2008-06-04
91SUGGEST

Instead of…

<%= image_tag product.image_url, :class => ‘list-image’ %>

2008-06-04
79TYPO

Not a typo but a question

Why do I get a name like this

:depot michelbrosseau$ ruby script/generate migration add_test_data
exists db/migrate
create db/migrate/20080603231948_add_test_data.rb
:depot michelbrosseau$

Thanks

(Sam says: You clearly are running rails 2.1; the book has now been updated to match this release.)

2008-06-04
allOK

The view pages are currently listed as rhtml and the demo code has all rhtml pages. The new Rails 2 convention is .html.erb

(sam says: This should not be the case for any chapters that have been marked as updated)

2008-08-10
131TYPO

“An .js.rjs template is a way of getting JavaScript on the browser to do what you want”: “An” should be “A”

2008-08-10
146SUGGEST

“<%= button_to ”Checkout“, :action => :checkout %>”: Put a “this line changed” triangle in front of this line, to show the reader which line they need to add for this step.

2008-08-10
172TYPO

“We have just limited access to the store iteself to administrators.”: “iteself” should be “itself”

2008-08-10
186TYPO

“Now we’ll use respond_to to vector to the correct template” … “:xml => product.to_xml(:include => :orders)": By including this ":xml => product.to_xml()” part at this point, it changes the XML generated so that it isn’t using the builder template any more, and therefore the XML generated doesn’t match the curl output shown just a few paragraphs down the page. The “:xml => @product.to_xml()” part should be omitted here (p. 186), and shouldn’t be added in until the “Autogenerating the XML” section (p. 187)

2008-08-14
285OK

“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, and the like. Do not load test data into your application this way.”:

This question has been on my mind ever since you had me do exactly that on pages 88-90. By creating the “add_test_data” migration for the Depot sample application, it looks like you’ve set the stage for my development test data to ultimately end up on the production server, right?

I think it would be good to add a footnote or other explanation on pp. 88-90 about not doing it this way for a real application, and/or showing the reader here a different method to populate data for the “development” environment that will not affect the “production” environment. (What would that method be? I’m still wondering.)

2008-08-14
35TYPO

3.3 Installing on Mac OS X

Leopard, but not to difficult either way.

not to -> not too

2008-08-10
122OK

The function for cart.total_price is incorrect, because it doesn’t take quantity into account. It should be:
def total_price
\t@items.sum { |item| item.price * item.quantity }
end

Instead of:
def total_price
\t@items.sum { |item| item.price }
end

(Sam: says: look at the definition of CartItem.price in app/models/cart_item.rb; item.price is defined as product.price * quantity)

2008-08-10
285OK

“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, and the like. Do not load test data into your application this way.”: Is it possible to put an if statement into up function to determine the environment (development or production) and act according?

(Sam says: Yes, but it is not recommended.)

2008-08-14
166OK

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

(Sam says: Page 166 in B1.3 contains the correct code for the users index view. No mention of products on that page.)

2008-08-10
244ERROR

“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 Rails’ own Subversion
repository…” Hasn’t rails moved away from subversion?

2008-08-10
250ERROR

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

2008-08-10
82SUGGEST

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 code, and in the following edit.html.erb modification, you use the f.label function vie ERb.

2008-08-10
80SUGGEST

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 back end, and the app seems to store at least four digits after the decimal. Perhaps sqlite does not use this directive? If so, the reader might be warned, or a different example chosen.

(Sam says: added a warning)

2008-08-14
145SUGGEST

The top of this page shows code :

class LineItem < ActiveRecord::Base
belongs_to :order
belongs_to :product
def self.from_cart_item(cart_item)
li = self.new
li.product = cart_item.product
li.quantity = cart_item.quantity
li.total_price = cart_item.price
li
end
end

However, at this stage the from_cart_item helper method has not been introduced. It is introduced and code supplied on page 152.

2008-08-10
153SUGGEST

Running the SQLite3 SQL

depot> sqlite3 -line db/development.sqlite3
SQLite version 3.4.0
Enter “.help” for instructions
sqlite> select * from orders;

Shows many fields that would not be there for those following along in the book (e.x ship_class, created_at, updated_at, customer_email, etc.)

2008-08-10
153TYPO

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 — it helps to scroll completely across when viewing). However, fields like customer_email and ship_class are not.

2008-08-10
364SUGGEST

The example used for create table may be updated to Rails 2 syntax. (t.integer instead of t.column)

2008-08-10
137TYPO

In the sentence that begins “The Rails generators automatically…”, the word “produts” should be “products”.

2008-08-10
481TYPO

In the sentence that begins “Our Depot application, for instance”, the word “produts” should be “products”.

2008-08-10
173TYPO

>redirect_to(:controller => “login” , :action => “login” )

I think this should be
redirect_to(:controller => “admin” , :action => “login” )

2008-08-10
110OK

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 be great if there was one of those references to a section in Appendix A that would explain what language feature makes this happen (for those of us learning Ruby as we are learning Rails). Also, it might be better if this footnote appeared on page 102 (where this snippet of code first appears).

(Dave says: it’s not a language feature. It’s just Rails saying "oh, I got a model, so I’ll ask for its id)

2008-08-10
133ERROR

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 found: 2(SERVFAIL)

2008-08-10
174SUGGEST

Should add “changes this” arrows to the <% if cart > .. <% end %> addition as well…

2008-08-10
77ERROR

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

2008-08-10
131OK

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 not updated. ruby ver 1.8.6 rails 2.1.0 on OS X 10.5.

(sam says: make sure the highlighted “respond_to { |format| format.js }” line is present in store_controller.rb)

2008-08-10
92TYPO

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 description is escaped.” The ‘the’ before HTML does not seem to fit. If that ‘the’ is removed, the sentence flows much better.

2008-08-10
406OK

ActionController::Routing::Routes is nil for me. Is there another step to initialize it?

2008-12-26
410OK

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 => “mycontroller”, :action => “index”
with the hint that you must delete [or rename] public\\index.html for this to work.

2008-08-14
172SUGGEST

[sorry; should have posted this here first. I posted it over in the forums section before realizing there was a separate errata system. No need to reply to the forum thread on this.]

The business about making the store layout the default layout for the application is sequenced oddly, in such a way as to generate some confusing errors that aren’t mentioned in the text.

If the instructions are followed in the order that the book lists them, then when the user visits localhost:3000/users immediately after putting the layout “store” instruction in application.rb, you get a route error (or at least, I got a route error doing this on Windows).

The text should say to remove to unnecessary products.html.erb and users.html.erb BEFORE telling the user to go look at either of those controllers.

Also-although I’m sure you know this-the illustrations for that section need to be fixed because the browser screenshots in them show the wrong URLs, which was also quite confusing for me until I remembered the note at the front of the book saying not to trust the illustrations.

2008-08-14
351OK

“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 intermediate table? Maybe refer to another page???

(Sam says: This is describing a shortcut “equivalent to the previous example”. It isn’t possible to set attributes using the shortcut, one one would need to follow the approach in the previous example.)

2008-08-14
454TYPO

In the paragraph starting with “As is usual with Rails…” it is written “… added to to-level application controller…” instead of “top-level application controller”

2008-08-10
77TYPO

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. You’ll find a
table called schema_mirations that it uses to keep track of the version number.7

should be

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. You’ll find a
table called schema_migrations that it uses to keep track of the version number.7

2008-08-10
71ERROR

Creating a new rails application with a specific database, the syntax is —database=TYPE (i.e. it needs an = between —database and the type). So the line

work> rails —database mysql depot

should read

work> rails —database=mysql depot

2008-08-10
240ERROR

Instructions created a Rake task in lib/task named db_schema_migrations.rake and then demonstrate running it with the command “rake db:schema_version”. The correct command to run the task should be “rake db:schema_migrations”.

2008-08-10
177TYPO

I think there is a typo in the third line of new code for the “destroy” method:

#{user.name}

should be:

#{@user.name}

2008-08-10
185ERROR

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 not necessary:

>>

Info#who_bought

>>

Find me in app/views/info/who_bought.html.erb

People Who Bought <%= product.title %></h3> <ul> <% for order in orders -%>

  • <%= mail_to order.email, order.name %>

  • <% end -%>

    Thanks!
    -Irene

    2008-08-10
    187SUGGEST

    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 the change was merely cosmetic, I found it to be confusing.
    Thanks,
    -Irene

    2008-08-10
    283OK

    When authoring a migration for the purpose of “creating data that’s a convenience for the developer when they play with the application”, it seems that the migration should be written so that it does not affect a production database. A comment here about how to check what environment the migration is running under (or perhaps some other way to do this) might be appropriate here.

    (Sam says: Per the book “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, and the like. Do not load test data into your application this way.”)

    2008-08-14
    194ERROR

    The product_test.rb generated automatically does not contain the fixtures :products as indicated on this page.
    This is using rails 2.1.0.

    Thanks!
    -Irene

    2008-08-10
    195SUGGEST

    Why the switch to mysql from sqlite3? The depot application has been using sqlite3 and it doesn’t quite seem consistent (or necessary) to switch without at least an explanation.

    Thanks!
    -Irene

    2008-08-10
    206ERROR

    We never created a LoginController… we created an Admin Controller with the methods: login, logout and index.

    Also, the automatic admin_controller_test.rb that is generated (rails gem ver 2.1.0) does not contain the sample you give, it only contains:

    require ‘test_helper’

    class AdminControllerTest < ActionController::TestCase
    # Replace this with your real tests.
    def test_truth
    assert true
    end
    end

    Thanks!

    2008-08-10
    208SUGGEST

    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 207 and goes to 208.
    Thanks!

    2008-08-10
    102SUGGEST

    Suggest you describe why using :id => product is okay as the “:id” of the item, as opposed to :id => product.id.

    2008-08-14
    103SUGGEST

    “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 are describing the return value of a method, the wording is technically correct. Perhaps “provides a list of items for sale” might be better.

    2008-08-10
    481ERROR

    Pagination as described in the section “Pagination Helpers” was deprecated and removed from Rails as of 2.0 (as per wiki.rubyonrails.org). They suggest the will_paginate plugin.

    2008-08-10
    77TYPO

    in footnote #7 on page 77, you refer to the migrations table as “schema_mirations” instead of “schema_migrations”

    2008-08-10
    79OK

    This line
    create db/migrate/20080601000002_add_price_to_product.rb
    should not have .db at the end.

    (Sam says: It has a .rb at the end)

    2008-08-10
    80SUGGEST

    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 gibberish to me. This is what one of mine looks like:
    20080617021145

    2008-08-14
    263TYPO

    rake db:migrate not ruby db:migrate

    2008-08-10
    335OK

    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 left to right and I usually assume the parent comes before the child. You may want to re-arrange your illustrations on the One-to-One relationships and the One-to-Many relationships, so that the parent table is to the left of the child tables (with the arrow connector pointing to the left).

    (Dave says: I like my arrows pointing inthe direction I read, so I think I prefer the diagrams this way)

    2008-12-31
    375TYPO

    in validates_inclusion_of, at options, :allow_nil appears twice. i think that the second is allow_blank

    2008-08-10
    494ERROR

    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.

    2008-08-10
    334OK

    The word “divine” in this sentence should be “define”?

    “…we can see why it’s hard for Active Record to divine the relationships between tables..”

    2008-08-10
    96OK

    after adding the storecontroller, i received an error “No route matches ”/login/index" with {:method=>:get}".

    restarting mongrel cleared the problem.

    might be providing this as a hint.
    why do i need to restart mongrel is a secondary question that the authors might like to shed some light on.

    i am running 2.0

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    131SUGGEST

    “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 after I googled it I found out that it’s a convention and that the name of the variable didn’t matter, only the “.js” did.

    Wouldn’t it be better if this was explained?

    2008-08-14
    567OK

    missing: code truncated

    (Dave says: we fix the code listings just before typesetting)

    2008-08-18
    298TYPO

    Substitue “class Book” with “class BadBook”

    The code says
    “class Book < ActivieRecord::Base
    self.primary_key = ”isbn"
    end"

    The next example says
    “book = BadBook.new
    book.id = ”0-12345-6789"

    I’m assuming that BadBook is defined by the Book class listed just prior to it use.

    2008-08-10
    136OK

    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 that, we need to change the store.html.erb layout in app/views/layouts. Our first attempt is something like this.

    <div id=“cart”
    <% if cart.items.empty? %> style="display: none" <% end %> > <%= render(:partial => "cart" , :object => cart) %>

    It doesn’t work, because in the code you do :

    <% hidden_div_if(cart.items.empty?, :id => "cart") do %> <%= render(:partial => "cart", :object => cart) %>
    <% end %>

    2008-08-14
    80TYPO

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

    should read four files rather than 3

    2008-08-10
    77TYPO

    In the third sentence of the page, there’s a missing character: “You’ll find a
    table called schema_mirations that it uses…”

    2008-08-10
    77OK

    Well, now I paid to be a beta tester…

    this command
    sqlite3 db/development.sqlite3 “select version from schema_migrations”
    does not work on my system (Windows, InstantRails 2.0). The answer is:
    SQL error: no such table: schema_migrations

    (sam says: schema_migrations is new in Rails 2.1)

    2008-08-10
    111OK

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

    Should sort it. Books needs to mention this.

    2008-12-26
    187ERROR

    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 the example at the end of page 185 and at the top of 186 (in the PDF), you have the same code for generating the XML as you do in this example namely “:xml => @product.to_xml(:include => :orders)”

    2008-08-14
    160OK

    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 the self., Ruby would have thought we were assigning to a local variable, and our code would have no effect.”

    Well, I can understand why “self.salt” instead of just “salt” but not the reason for the sudden change to “self.salt” from “@salt”. I believe that an explanation is necessary, especially because the User class doesn’t have a “salt=” accessor.

    2008-08-18
    102SUGGEST

    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 add this code:

    <%= button_to “Add to Cart” , :action => :add_to_cart, :id => product %>

    2008-08-10
    107TYPO

    To quote Chuck Hinson:

    "#31714: The statement on pg 105

    ‘The next time you restart your application (stopping and starting script/server), it will store its session data in the database. Why not do that now?’

    suggests (to me at least) that my application will now work properly with cookies. Yet restarting the server as suggested and then trying to view a page in my browser results in an error. … it would be nice to include an indication that while a restart is necessary, there’s still one more thing to do before the cookie stuff works properly."

    I agree, although now it’s on Page 107.

    2008-08-10
    87TYPO

    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 109:
    “Be careful as you add methods to this controller as we work further on the cart—if you add them after the private declaration, they’ll be invisible outside the class. New actions must go before the private line.”

    2008-08-10
    230ERROR

    The listing of the dynamic fixture ‘test/fixtures/performance/products.yml’ appears to be incorrect.

    The lead in to the listing reads ‘To create all these products, let’s use a dynamic fixture.’ What follows that appears to be a very non dynamic, very static fixture.

    #START:ruby
    ruby_book:
    id: 1
    title: Programming Ruby
    description: Dummy description
    price: 1234
    image_url: ruby.png
    #END:ruby

    rails_book:
    id: 2
    title: Agile Web Development with Rails
    description: Dummy description
    price: 2345
    image_url: rails.png

    In addition to the listing in the book being incorrect, the accompanying online version is also static. (/titles/rails3/code/depot_r/test/fixtures/performance/products.yml).

    There appears to be no difference between this fixture and the static fixture introduced on page 199 (titles/rails3/code/depot_r/test/fixtures/products.yml).

    The second edition of the book contains the following listing in the same spot. (titles/rails2/code/depot_r/test/fixtures/performance/products.yml)

    <% 1.upto(1000) do |i| %>
    product_<%= i %>:
    id: <%= i %>
    title: Product Number <%= i %>
    description: My description
    image_url: product.gif
    price: 1234
    <% end %>

    Happy to stand corrected if I’ve missed something obvious.

    2008-08-10
    80TYPO

    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 in others)

    2008-08-10
    360TYPO

    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 four entries; there should only be three.

    2008-08-14
    57OK

    #5 “substituting in values”

    The “in” is redundant. Recommend using “substituting values.”

    2008-08-10
    571ERROR

    in place editing has been moved to a plugin.

    2008-08-10
    89OK

    The migration code contained this assignment to image_url:

    :image_url => ‘/images/svn.jpg’ ,

    when I run the example, the generated html did not render an image. The source reveals that the images directory is doubled up:

    Svn

    2008-12-26
    80TYPO

    you have to edit three files

    should read

    you have to edit four files

    2008-08-10
    84SUGGEST

    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 declaration, and link to appendix A.4, on p. 651, where this concept is defined.

    I looked at it and was momentarily puzzled, coming from a C/C/Java background, as to what, if anything, the statement would do.

    2008-08-10
    194ERROR

    When my version of Rails 2.1.0 (installed from RubyGems) automatically creates test files, the first line reads:

    require ‘test_helper’

    Rather than

    require File.dirname(FILE) + ‘/../test_helper’

    Some other errata reporters have the same require statement (see, e.g., #32390).

    Having the version of require without the context of FILE breaks the attempt to run product_test.rb as a single unit test using the call on page 194 of:

    ruby test/unit/product_test.rb

    To work with both versions, it would be smart to include the test directory explicitly:

    ruby -Itest test/unit/product_test.rb

    2008-08-10
    18SUGGEST

    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 section on database modelling tools.

    I am in the process of writing a spec for a new Rails app and it would be nice to have a section that briefly covered database modelling tools, that may fit nicely with the Rails environment.

    I am at the point where I am writing a database Schema specification and would love to know if there is anything that would be advantageous to use for this process, and if not then it may be worth a mention that this is the case.

    I appreciate that rails development is all about iteration and not so much planning but I have a major application that needs a visual representation of the database and or model and really needs plannoing in advance and it might fit in nicely with the Rails Is Agile 1.1 section.

    I have got to the stage where this project already involves 20 tables and is growing every day and as I am my own customer as such it would be really good. Honest :-)

    Just a thought

    James

    (Dave says: That’s really outside the scope of this book)

    2008-08-10
    226OK

    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 (in the Source Code appendix).

    2008-08-14
    656OK

    A.8 Regular Expressions

    When it comes to updating this part of the book could you please explain the code supplied for the depot application on page 88

    %r{\\.(gif|jpg|png)$}i particularly the $ and the i bits.

    It would be most useful to understand exactly how this works.

    Thanks

    2008-08-14
    108OK

    When you write session :session_key => ‘_depot_session_id’, I suggest you remind readers that in this context, session is a declaration, and not to be confused with the session hash mentioned just mentioned.

    2008-08-14
    135SUGGEST

    There are no green arrows next to the new coded added to the _cart partial at the bottom of pg 135

    2008-08-10
    564SUGGEST

    Latest version of ruby does not support text_field_with_auto_complete

    2008-08-10
    108OK

    After adding the cart and cookies to the application, I started getting “ActionController::InvalidAuthenticityToken” error messages whenever I tried to add a book to the cart. I resolved this by adding “protect_from_forgery :only => [:create, :update, :destroy]” to the top of the store_controller.rb file.

    2008-12-26
    497OK

    Inside the gray box, item #2, edit.rhtml should be edit.html.erb.

    2008-08-10
    480TYPO

    produts should be products

    2008-08-10
    144ERROR

    I think “version 4” in the paragraph about both migrations being applied is left over from the old rails way of doing things - the new date-based format for migration names and DB schema versions renders it useless.

    2008-08-10
    52OK

    The output of erb/ex2.op sample outputs
    Ho!
    Ho!
    Ho!
    Merry Cristmas!

    as expected (and no blank lines in between), not

    Ho!

    Ho!

    Ho!

    Merry Christmas!

    as written in PDF.

    (Sam says: the blank lines are in the source, not the output)

    2008-08-10
    75SUGGEST

    In the commandline examples: It is sometimes hard to distinguish what is to be typed and what is actually output from the commandline (especially with line wraps). I suggest to clear this that a different colour or bold is used for the command itself.

    2008-12-31
    77TYPO

    The table “schema_migrations” (or indeed “schema_mirations”) doesn’t exist in my (postgres) database; instead it is named “schema_info”.

    (Sam says: typo fixed; schema_info changed to schema_migrations in Rails 2.1)

    2008-08-10
    170SUGGEST

    When I got to this page and looked at the nice login form in figure 11.1, then compared it to the completely plain one in my application, I realized that we never made an admin layout. Maybe that should have been obvious, but I missed it. Just copying the users layout and editing it seemed to do the trick.

    2009-01-07
    75TYPO

    The final parenthetical statement on the page reads as follows:

    “(And how will it find that table? We told it where to look when we set up the development entry in config/database.yml.)”

    Note that this only makes sense to someone who didn’t follow the advice on page 70 and decided to use MySQL as their development database, and thus, read through the next 4 pages on setting up the config/database.yml. It might be a good idea to point out (in a slightly different way than saying “…we set up…”) that the database.yml file tells the application where to look for the appropriate table for those readers who didn’t setup their db config file earlier, otherwise this statement could cause a bit of confusion for the reader.

    2008-08-10
    177TYPO

    flash[:notice] = “User #{user.name} deleted”

    should be

    flash[:notice] = “User #{@user.name} deleted”

    2008-08-10
    143OK

    I have a problem with the migrations, I use MySQL and I can’t create the foreign keys with :options parameter…, I can’t use it for nothing… t.integer number, :options => “unsigned” fails…(do the same without :options), I also probe with commas.

    sorry for my english, I don’t know if is the site for this problem re-sorry

    thanks

    (Sam says: the example is only for sqlite)

    2008-08-10
    140SUGGEST

    maybe it should be better to change the code to:
    respond_to do |wants|
    wants.html {redirect_to_index}
    wants.js
    end

    So people get used to doing that instead of doing request.xhr?

    (Sam says: Unfortunately, I have been able to make such code return back js for non xhr requests, but adding “if request.xhr?” to the wants.js addresses that.)

    2008-08-14
    260SUGGEST

    At the end of section 15.3 (String Extensions) it says: “In a Rails application, these changes can go in the file environment.rb in the config directory.”
    Wouldn’t it be a bit cleaner to put custom inflections into “config/initializers/inflections.rb”?

    2008-08-14
    76OK

    Attempting to run rake db:migrate from top level dir the first time gives error:
    kant:~/ruby_rails/depot cpaule$ rake db:migrate
    (in /Users/cpaule/ruby_rails/depot)
    rake aborted!
    no such file to load — sqlite3

    (See full trace by running task with —trace)
    The database.yml file looks like:
    $ more config/database.yml

    1. SQLite version 3.x
    2. gem install sqlite3-ruby (not necessary on OS X Leopard)
      development:
      adapter: sqlite3
      database: db/development.sqlite3
      timeout: 5000
    1. Warning: The database defined as “test” will be erased and
    2. re-generated from your development database when you run “rake”.
    3. Do not set this db to the same as development or production.
      test:
      adapter: sqlite3
      database: db/test.sqlite3
      timeout: 5000

    production:
    adapter: sqlite3
    database: db/production.sqlite3
    timeout: 5000
    So it appears that Rails wants to see a previously created db file named sqlite3.
    But the book on page 70 says "there are no steps required to create a database with Sqlite3.
    I am running Rails 2.1.0 and ruby 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.11.0] on a Mac OS X Version 10.4.11.
    My email is cpaule@umn.edu
    Thanks!

    (Sam says: user apparently didn’t install sqlite3-ruby as described on page 36)

    2008-08-10
    37TYPO

    In the section titled “Version Control”, second paragraph, “It’s simple way …” should be “It’s a simple way …”

    2008-08-10
    40OK

    When trying to create my own rails API documentation as descibed at the top of this page, I got an error when executing the command “rake rails:freeze:gems” of:

    uninitialized constant Gem::GemRunner

    I found that I needed to edit the file /usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/tasks/framework.rake and add the line “require ‘rubygems/gem_runner’” as follows:

    deps = %w(actionpack activerecord actionmailer activesupport actionwebservice)
    require ‘rubygems’
    require ‘rubygems/gem_runner’
    Gem.manage_gems

    (Dave says: This seems like a problem with your installation. I’d ask on the Rails list)

    2008-08-10
    509ERROR

    Its “titled multiple model in form”
    The example is regarding new and creating models.

    Product.transaction do
    details.product = product
    product.save! details.save!
    redirect_to :action => :show, :id => @product
    end

    Here in the above code, one cant have details.product = product without saving the product first. The code should be as follows:
    Product.transaction do
    product.save! details.product = product details.save!
    redirect_to :action => :show, :id => @product
    end
    I was trying it out on one of my project and took me an hour to figure it out. Hope this error will be corrected in the next edition of the e-book.

    2008-08-14
    49OK

    I am trying this on a linux system that uses postgresql rather than sqlite3. When trying to perform the say/hello action to get the Missing Template screen, I got several errors about database. To get around it, I had to modify the config/database.yml file and issue postgres commands to create the database. Perhaps a Note here would help those who aren’t using exactly the same setup would be useful.

    (Sam says: A database should not be required for /say/hello. This is covered in chapter 6.)

    2008-08-14
    78ERROR

    I have been following along doing everything on a linux system with postgresql. Everything has worked OK and I have made the appropriate changes for postgresql. Now that I try to use the browser to go to products I get the following Routing Error:

    No route matches “/products” with {:method=>:get}

    I am not quite sure how to proceed at this point.

    (Sam says: Added a suggestion to restart the server)

    2008-08-14
    494SUGGEST

    Paginate has been removed from the Rails 2.1 and as such it is recommended to you will_paginate as plugin. I tried the will_paginate and it was cool.

    It would be worth mentioning about it in the book as I toiled with the method paginate not found error on rails 2.1. I had to figure it out that the paginate support has been taken out of core rails 2.1

    Hope this is useful.

    2008-08-10
    384SUGGEST

    The last sentence of 19.1 (Validation) under subsection “Validation Error Messages” states: “You’ll probably want to put this in the environment.rb file in your application’s config directory.”
    Wouldn’t something like “config/initializers/active_record_errors.rb” be a cleaner location to put reconfigured error messages?

    2008-08-14
    143OK

    For those out there trying to follow along with the book but use postgresql rather than sqlite3, then the migration file that creates line_itmes needs to look like this (took me several hours to figure this out):

    class CreateLineItems < ActiveRecord::Migration
    def self.up
    create_table :line_items do |t|
    t.integer :product_id, :null => false, :options =>
    “CONSTRAINT line_items_product_id_fkey FOREIGN KEY (product_id) REFERENCES products(id)”
    t.integer :order_id, :null => false, :options =>
    “CONSTRAINT line_items_order_id_fkey FOREIGN KEY (order_id) REFERENCES orders(id)”
    t.integer :quantity, :null => false
    t.decimal :total_price, :null => false, :precision => 8, :scale => 2

    t.timestamps
    end
    end

    def self.down
    drop_table :line_items
    end
    end

    2008-08-10
    97SUGGEST

    Please emphasize this code: “def self.find_products_for_sale
    find(:all, :order => ”title“)
    end” has to go before the validation lines to avoid an error…

    2008-08-10
    166ERROR

    The book suggests the line:

    Enter User Details
    Enter User Details

    but I see an extra line in the form of “Enter User Details” unless I do:

    Enter User Details

    2008-08-10
    175TYPO

    The listing of depot/app/views/layouts/store.html.erb has arrows highlighting several lines to be added to the original version of this file.

    Unfortunately, two added lines are not highlighted in this way:

    <% if @cart %>

    and its corresponding end

    <% end %>

    2008-08-10
    240TYPO

    The rake command should be < rake db:schema_migrations >.

    2008-08-10
    442ERROR

    rhtml, rjs and rxml aren’t used anymore.

    2008-08-10
    284ERROR

    directory = File.dirname(FILE)
    should be
    directory = File.join(File.dirname(FILE), “dev_data”)

    2008-08-10
    172OK

    Having the before_filter applied before the creation of a session can result in being redirected to login twice in a row when the suggested improvements to save the original request URI are made.

    class ApplicationController < ActionController::Base
    before_filter :authorize, :except => :login
    session :session_key => ‘_depot_session_id’

    2008-08-14
    77TYPO

    “schema_mirations”

    2008-08-10
    163OK

    The full code of user.rb starts off with require ‘digest/sha1’ on the first line, however it’s not mentioned in the instructions leading up to this. It might be a little confusing for some.

    (Sam says: Even in B1.3, it was mentioned on page 160)

    2008-08-14
    249OK

    StoreController should be StoresController. Also, store_controller.rb should be stores_controller.rb.

    (Same says: correct as is: http://tinyurl.com/6e3pe8)

    2008-08-10
    463ERROR

    class name is wrong, says
    “class ApplicationController < ActionController::Base”
    instead of
    “class AdminController < ActionController::Base”

    Also, the code sample is repeated. I think it was supposed to be broken up into smaller chunks?

    2008-08-10
    638OK

    Get an error when installing rake, isn’t it just part of rails now anyway?

    2008-08-10
    640ERROR

    cap —apply-to /local/project/path [applicationname]
    isn’t that now just:
    capify .

    2008-08-10
    175TYPO

    There hasn’t been a controller generated for Orders yet.

    2008-08-10
    195OK

    It might be a good idea to remind readers to add your password to the database.yml file here.

    2008-08-14
    36SUGGEST

    the command: sudo gem update sqlite3-ruby does not seem to do an update (system: ubuntu) if sqlite3-ruby is not already installed?? maybe this should be specified in some way?
    thanks,brice

    2008-08-10
    77OK

    In Section 6.1 we initiate the “depot” application using the default “database.yml” containing sqlite3 adapter.

    Afterwards we reset it and use mysql adapter, and we execute some queries in mysql environment to test our configuration.

    At the beginning of page 77 (pdf) we are asked to check the existence of table “schema_migrations” in sqlite3 environment.

    Is there a flow erratum?

    (Sam says: missed the second paragraph on page 70 which says to skip to page 74)

    2008-08-10
    87OK

    validate :price_must_be_at_least_a_cent
    protected
    def price_must_be_at_least_a_cent
    errors.add(:price, ‘should be at least 0.01’) if price.nil? ||
    price < 0.01
    end

    Now shouldn’t the if-clause if price.nil? || price < 0.01 have :price instead of price?, note the colon.

    (Sam says: The syntax is correct as is. There is a difference between the name of the variable (which is used to match the field on the form) and the value of the variable (which is compared against nil and 0.01))

    2008-08-14
    307TYPO

    On the very last row of regular text: ‘“po,”’ should read ‘“po”,’

    2008-08-10
    227TYPO

    “We saw an example of multiple sessions in the test on page 225.” The example actually starts on 226.

    2009-10-17
    267TYPO

    When creating the “person” model, the right command to do the database migration isn’t “rake db:migrate” instead of “ruby db:migrate”?

    2008-08-10
    454TYPO

    “to-level” should probably be “top-level” in the following sentence:

    Every new Rails application already has one example of this—a declaration such as the following is added to the to-level application controller to set an application-specific cookie name for session data.

    2008-08-10
    45OK

    Rails 2.1 now uses Mongrel by default instead of WEBrick when running ‘ruby script/server’.

    2008-08-10
    488SUGGEST

    I’ve apparently run into a common issue in learning helpers. I got the idea from the text that I could use a helper function inside my controller by using the helper: method. It took me several more readings to realize that helper functions are only available in views.

    I did find this in a rails faq:

    Is it possible to call a helper from the controller?

    No, but you can move the helper method into the controller and add helper_method :method_name after the definition to make it available to the view again.

    So, suggestion: call this out and make it clear - you can’t use helper functions from within controllers.

    2008-08-14
    129OK

    Figure 9.1 shows the ‘empty cart’ button below the cart in the sidebar, but when you refer to figure 9.1 on p 128, we haven’t changed the code to move the button yet.

    (Sam says: Page 127, the button is in the partial)

    2008-08-10
    131OK

    For reasons I can’t understand at all, with Rails 2.1, my shopping cart in the sidebar was not getting refreshed until I removed the
    respond_to { |format| format.js }

    line from the end of my StoreController.add_to_cart method. After that, my add_to_cart.js.rjs worked fine. ?

    2008-12-26
    140TYPO

    In the StoreController.add_to_cart revision that degrades gracefully in the absence of Javascript, you did not include the arrows showing the new code.

    2008-08-10
    257ERROR

    “It always returns true for nil and false, and
    it always returns false for numbers and for true.”

    Huh?

    2008-08-10
    265TYPO

    “However, Rails 1.2 includes a fix for this.”

    Should be

    “However, Rails 1.2 included a fix for this.”

    2008-08-10
    130SUGGEST

    If the reader has done the ‘playtime’ suggestion that involves making the clicking the book images perform the add_to_cart action then they won’t work when the button is ajaxified. It would be worth mentioning that in index.html.erb the line

    <%= link_to image_tag(product.image_url), {:action => :add_to_cart, :id => product} %>

    should be replaced by

    <% form_remote_tag :url => {:action => :add_to_cart, :id => product } do %>
    <%= image_submit_tag(product.image_url, :class => “click_img”) %>
    <% end %>

    Also the line in depot.css that reads

    #store .entry img {

    should be changed to

    #store .entry .click_img {

    (Sam says: Fixed by adding another playtime activity in chapter 9)

    2008-08-14
    127OK

    On this and several pages before it, you describe the use of <->, instead of <%= %>. It causes server errors.

    (Sam says: I don’t see this in my copy)

    2008-08-10
    161SUGGEST

    As you go into the definition of the method password, it would be worth noting that these are public defs, as opposed to the private defs we just did with the salt.

    2008-08-14
    223ERROR

    The first argument to the method post_via_redirect is:
    “/store/save_order”

    However, when I use that arg, the following error occurs:
    “Expected response to be a <:success>, but was <500>
    <”Missing template store/save_order.html.erb in view path …"

    I corrected this by replacing the second argument with:
    “/store/checkout”

    2008-08-10
    226ERROR

    The first argument to the method post_via_redirect is:
    “/store/save_order”

    It should be:
    “/store/checkout”

    2008-08-10
    273TYPO

    I saw you were releasing another version early next week, and thought I should get this in.

    In the fifth paragraph on the page:
    “files woulc match” should be “files would match”

    2008-08-10
    278TYPO

    Last paragraph prior to “Options for Creating Tables” section.
    “creates the both the” should be “creates both the”

    2008-08-10
    405SUGGEST

    Our demonstration of routes did not specify starting in any particular rails application directory.

    The second thing we are asked to do - “puts rs.routes” - comes up with only two actions, which indicates that we must be in a default rails application. However, I tried using a default rails app, and then trying
    rs.recognize_path “/store”
    resulted in an error:
    ActionController::RoutingError: No route matches “/store” with {}

    Trying the same thing in the depot application worked fine, but then I got far more output to the “puts rs.routes”.

    I suggest giving a little more guidance - tell folks to use the depot application, and if you do, tell them the rs.routes output they will get is much more than what you’ve shown.

    2008-08-14
    24OK

    On this page (and page 26) we discuss “the model” and “the view”. It seems more natural here to say “a model” and “a view” (as it does in at least one place here).

    2008-08-14
    25OK

    3rd paragraph: “This triumvirate—the model, view, and controller—together form an architecture known as MVC.”

    How about: “This triumvirate—the model, view, and controller—together FORMS an architecture known as MVC.”

    2008-08-14
    49TYPO

    Bottom: “That directory contains the template files for the controller’s views.”

    How about: “That directory WILL CONTAIN the template files for the controller’s views.”

    (after all, at this point the directory is empty)

    2008-08-14
    50TYPO

    Footnote 5: “While you can continue to use rhtml extension…”
    How about: “While you can continue to use the .rhtml extension…”

    2008-08-14
    50TYPO

    Footnote 5: “Information on how this can be accomplished can be found in on page 243.”

    How about something like: “Information on how this can be accomplished can be found in Chapter 14 on page 243.”

    (Sam says: Link removed; generated applications now do this by default)

    2008-08-14
    57OK

    2nd-to-last paragraph: “In our case, we’ll also use a new action method to handle the page (although that isn’t always the case, as we’ll see later in the book).”

    How about: “In our case, we’ll also use a new action method to handle the page (although that NEEDN’T always BE the case, as we’ll see later in the book).”

    2008-08-14
    58OK

    3rd paragraph: “In a real application we might want to make these proper buttons, but for now we’ll just use hyperlinks.”

    How about removing this sentence? (What’s wrong with hyperlinks anyway?)

    2008-08-14
    106TYPO

    Paragraph beginning with “One choice would be to stores session …”; I believe “stores” should be “store”.

    2008-08-14
    170OK

    I had to do a “mongrel_rails restart” after adding admin controller. Was getting “No controller responded to.. etc..” when trying to view /admin. Guessing there’s some caching problem with mongrel — might want to add a note that a restart may be required.

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    136OK

    As far as I can discern from the examples, when passing a cart collection to _cart_item.html.erb the table is not created if the collection is empty. Therefore, when the add_to_cart.js.rjs is triggered it references the id ‘current_item’, but with a new empty cart this table is not created before the rjs is triggered and ends up with a ‘null value’ rjs error. How I see to fix the problem is in the rjs template:

    page[:current_item].visual_effect :highlight, :startcolor => “#88ff88”, :endcolor => ‘#114411’ unless @cart.total_items == 1

    This still solves the problem since the blind_down effect is done on the creation of a new cart and still catches the eye, and any subsequent additions to the cart causes the flash effect

    (Sam says: The add to cart response should only be produced after a product has been added to the cart. This would imply that the collection should never be empty.)

    2008-08-14
    91OK

    I wonder why there is not an <h1….> tag for the Show action. After applying the css styling this possible inconsistency is evident because the dashed blue line is visible for Index and Edit actions. Anyway, it is not a big deal but it did alert me for a few seconds and I started getting confused (I’m a little slow!).

    2008-08-14
    160SUGGEST

    Perhaps should be made clear that accessor methods should not be private (and why) or this will cause some confusion shortly when attempting to use the model

    2008-08-14
    104SUGGEST

    The examples given for the number_to_currency helper method show corresponding example outputs. However, the chosen indicator, “=>”, which directs readers attention to the ouput, is the same as one of the operands in the code. Essentially there are too many “=>” symbols.

    2008-12-31
    73TYPO

    2nd bullet item: “Check that the user name and password in database.yml match the one you created on page 70.”

    How about replacing “one” with something like “user”, “account”, or “ones”.

    2008-08-14
    76SUGGEST

    I’m finding the migration numbers in the depot example somewhat confusing. With endings like “000001”, “000002”, etc, they appear to be sequence numbers appended to a date, until we get to the footnote on page 79 that says they are ‘clearly fictitious’.

    Also, from the footnote on this page (76) it appears we can still refer to them by version number (‘VERSION=0’) when moving backward or forward to a specific migration.

    And on top of all that page 89 says: “Don’t be concerned if the timestamp of the file you downloaded is before others that you have already migrated as Rails knows which migrations have been completed and which ones have yet to be done.”

    This has me wondering, how does Rails order the migrations? And shouldn’t that ordering be obvious to any developer who looks at the project? If the ordering of the timestamps can’t be relied upon, how do we keep it straight?

    (Sam says: Moved footnote to first occurrence. At the place where the footnote was, the text indicates that the timestamps are used for ordering.)

    2008-08-14
    84SUGGEST

    Top: “The speed with which you can turn words into a working application with Rails means that you’re never far from being able to let the client play with their application. These short feedback cycles mean that both you and the client get to understand the real application sooner, and you waste far less time reworking your application.”

    That last “application” at the end sounds like one too many uses of the word after everything that precedes it!

    2008-08-14
    84SUGGEST

    Bottom: “…the same reloading that caused Rails to notice the earlier change to our schema also means it will always use the latest version of our code, too.”

    The “too” at the end feels redundant after the “also”.

    2008-08-14
    86OK

    The superscript “11” seems out of place, since the footnote has nothing to do with the price being greater than zero. It might go better with one of the earlier paragraphs.

    2008-08-14
    87SUGGEST

    Footnote 12: “Checking the number is at least one cent ensures…”
    How about: “Checking THAT the number is at least one cent ensures…”

    2008-08-14
    87OK

    Url validation part makes me wonder if there is a built-in validator in Rails that checks whether a string is a legal url…

    (Sam says: There is a plugin http://github.com/RISCfuture/validates_url/tree/master)

    2008-08-14
    89OK

    Top half: the “data-only migration” in the tutorial has me wondering, why mix test data with the schema definitions? This seems kindof ugly, and surely we don’t want this test data inserted into our production database. What is the benefit of setting up our test data this way?

    2008-08-14
    90SUGGEST

    Line numbers might be helpful in the code sample, since the text afterward refers to the ‘eighth line’.

    2008-08-14
    173SUGGEST

    After rake:db:sessions:clear when using MySQL the app breaks.

    Mysql::Error: Lost connection to MySQL server during query: SELECT * FROM `sessions`

    It’s fixed by restarting the app server.

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    380TYPO

    it currently says: “:allow_blank boolean If true, nil attributes are considered valid ”

    but it should be
    “:allow_blank boolean If true, blank attributes are considered valid”

    2008-08-14
    173OK

    the hidden_div_if helper method causes a bunch of problems if you simply switch the default layout to “store”. for one, we placed the helper in StoreController so this raises a NoMethodError when attempting to access the Users controller. a fix is placing the helper method in the application helper. second, we still have an issue with this since the way that it is written asks the object @cart if it is empty. this will give a nil object error since if there is no cart and the user is coming directly to /users the cart is never created. the fix is to modify the logic a bit to check for a cart and then check to see if the cart is empty in the store layout:

    <% if cart %> <% hidden_div_if(cart.items.empty?, :id => “cart”) do %>
    \t<%= render(:partial => “cart”, :object => @cart) %>
    <% end %>
    <% end %>

    (Sam says: That’s exactly what pages 173-174 describe, complete with triangles pointing to the lines you need to add.)

    2008-08-14
    173OK

    apologies, the next page (174) fixes the hidden_div_if problem as I described, and checking for @cart ‘should’ make sure that the hidden_div_if is never called but it’s still safer to move it into the application_helper. also, the book suggests navigating to the admin controller right after making the change to the ‘store’ layout anyway which will cause errors immediately

    2008-08-18
    174TYPO

    we didn’t create an ‘orders’ controller, so you may not want to have that in the html currently…

    2008-08-18
    193SUGGEST

    Top: “The fact that ProductTest is a subclass of the Test::Unit::TestCase class tells us that Rails generates tests based on the Test::Unit framework…”

    In the example right before this text, ProuctTest is obviously a subclass of ActiveSupport::TestCase, but I’m not clear on what the relationship is between ActiveSupport::TestCase and Test::Unit::TestCase…

    2008-08-18
    194SUGGEST

    4th paragraph: “there’s a short cut.”

    Should “short cut” be one word?

    2008-08-18
    196TYPO

    3rd paragraph: “Next, we’ll test that we’re validating the image URL ends with one of .git, .jpg, or .png.”

    How about: “Next, we’ll test that we’re validating THAT the image URL ends with one of .git, .jpg, or .png.”

    2008-08-18
    198TYPO

    End of 2nd paragraph of “David Says…” sidebar: “…then paying his valid_credit_card…”

    How about: “…then paying WITH his valid_credit_card…”

    2008-08-18
    199TYPO

    Top: “And, in fact, Rails is already doing this, (convention over configuration for the win!), but you can control…”

    How about: “And, in fact, Rails is already doing this (convention over configuration for the win!), but you can control…” (remove 3rd comma)

    2008-08-18
    199TYPO

    Right after “Using Fixture Data” heading: “Now we know how to get fixture data into the database, we need to find ways of using it in our tests.”

    How about: “Now THAT we know how to get fixture data into the database, we need to find ways of using it in our tests.”

    2008-08-18
    193TYPO

    Footnote 2: “If you are using a database other my SQLite3…”
    How about: “If you are using a database other THAN SQLite3…”

    Also: “If so, you will need to create such a database.”
    How about changing “such a” to “a” or “your”

    2008-08-18
    194TYPO

    2nd-to-last paragraph: “If I want to run all my tests, I use this rake task.” (referring to ‘rake test:units’)
    How about: “If I want to run all my UNIT tests…”

    2008-08-18
    200SUGGEST

    The test we write manually (CartTest) is inheriting from Test::Unit::TestCase while the generated ProductTest we saw earlier inherited from Test::Unit::TestCase. Wondering what the distinction is, and if there’s a reason to choose one over the other. (I see this was submitted for build 1.0 for this page number, but I think my question is a little different).

    2008-08-18
    200OK

    2nd-to-last paragraph: “Notice that we’ve included the existing products fixture into this test.”

    Should this be, “…into this test CASE.”? Or is it correct either way?

    2008-08-18
    486TYPO

    othermost should probably have been outermost

    2008-08-18
    208TYPO

    “Now we’re ready to test the index action again. We have to remember to add
    the fixtures directive to the login controller test class.”
    - there should be admin controller mentioned here.

    2008-08-18
    411ERROR

    The method “url_for” can be used on the console. Simply call it on the “app” object, which the console creates for you. Eg:

    ?> app.url_for :controller => :store, :action => :display, :id => 123

    2008-08-18
    422TYPO

    The phrase “as described Section 20.2” should be “as described in Section 20.2”.

    2008-08-18
    423ERROR

    Using Rails v2.1.0 and running the “generate scaffold” command listed on the previous page, the last line of output is not “route map.resources :articles”. That line is located near the middle of the output.

    2008-08-18
    227OK

    In the test_two_people_buying a hash MIKES_DETAILS is used but not previously mentioned in the text. Of course the appropriate listing can be found in the depot_r/test/integration/dsl_user_stories_test.rb but it would be better to show it explicitly.

    2008-08-18
    448TYPO

    The phrase “the one that ends blog/add_comment” should be “the one that ends in blog/add_comment”.

    2008-08-18
    498ERROR

    The text box labelled “edit.html.rb” should actually be “edit.html.erb” (IE: “.erb”).

    2008-08-18
    499TYPO

    The phrase “a name ending _tag” should be “a name ending with _tag”.

    2008-08-18
    510TYPO

    To be consistent, “we say how on page 494” should be “we saw how …”.

    2008-08-18
    268TYPO

    “Your terminal man not display the Unicode character correctly, but you can verify that the length is correct.”
    I believe that: “Your terminal may not…” would be better.

    2008-08-18
    159OK

    The definition of the self.encrypted_password method contains this line:

    string_to_hash = password + “wibble” + salt

    No explanation of what purpose “wibble” serves here is given. It would typically not be a big deal, except the password generation code is already fairly circuitous for a beginner, so it’s confusing to use both both a salt and this odd extra tacked on.

    2008-08-18
    205SUGGEST

    Paragraph on @response: “Every time we send a request back to a browser, Rails is populating a response object behind the scenes.”

    Seems like this would be clearer as: “Every time we send a RESPONSE back to a browser, Rails is populating a response object behind the scenes.”

    2008-08-18
    206OK

    3rd paragraph: “The get method, a convenience method loaded by the test helper, simulates a web request (think HTTP GET) to the index action of the AdminController and captures the response.”

    It seems like we’re not exercising (or otherwise following) the RESTful routes here. After all, the index action is implicitly the result of a GET (a POST to the same url would be routed to the create action, right?)

    Page 222 talks about calling get with a url parameter for integration tests… I’m wondering if this can also be done for controller tests.

    2008-08-18
    206ERROR

    Last paragraph: “…that’s the way we designed the AdminController. It uses a before filter to intercept calls to actions that aren’t available to users without an administrative login.”

    The example immediately below shows this before filter in the ApplicationController, not the AdminController (which makes sense of course, otherwise it wouldn’t be used application-wide).

    2008-08-18
    207OK

    Bottom:
    We’ll call the user “dave.”

    I think the period should be outside the quotes…

    (Dave says: in this context, it’s correct where it is.)

    2008-08-18
    208SUGGEST

    Last paragraph: “Parameter two is an empty hash—this represents the HTTP headers to be passed to the action.”

    Headers? Page 210 says it is ‘parameters’, not headers. I’m assuming ‘parameters’ means either urlencoded key-value pairs such as “?key1=value1&key2=value2…” or the type that can go into the request body (in the case of POST or PUT), and that ‘headers’ means HTTP headers such as ‘Content-Type:’ and ’Accept-Encoding:".

    Of course, this makes me wonder: shouldn’t we be able to specify both? If this argument is for parameters, how do we specify headers (and vice versa)?

    Also, this says ‘parameters’ in my copy of the 2nd edition. Has something in Rails changed here?

    Also, headers are in the integration testing versions of these request methods! On page 229 they are described with arguments shown for both params and headers.

    2008-08-18
    209SUGGEST

    3rd-to-last paragraph: “Before we go much further, let’s look at some of the Rails-specific conveniences for teting controllers.”

    Seems like we’ve been doing this already. Should “let’s look at” be “let’s take a closer look at”?

    2008-08-18
    210TYPO

    “You’ll often want to post form data within a function test.”
    How about:
    “You’ll often want to post form data within a FUNCTIONAL test.”

    2008-08-18
    210SUGGEST

    “To do this, you’ll need to know that the data is returned as a hash nested inside the params hash.”
    How about:
    “To do this, you’ll need to know that the data is SUBMITTED as a hash nested inside the params hash.”

    2008-08-18
    210SUGGEST

    “So, to post a form to the edit action containing User model data…”

    Wouldn’t a post go to a create or update action (not edit)?

    2008-08-18
    210TYPO

    “You can simulate an xml_http_request using…”

    How about a little mention about what is different about an ‘xml’ http request from the server’s perspective (is it simply a value in one of the HTTP headers?)

    Also, in the description of xml_http_request immediately below, it says: “The first parameter will be :post or :get.” Is this a restriction on the xml_http_request method being described here? Why have such a restriction? (I think browsers are moving away from this…)

    On page 229, there’s a description of a seemingly more permissive version of xml_http_request for integration tests, which accepts HEAD, GET, POST, PUT or DELETE.

    2008-08-18
    210TYPO

    Under “Assertions” heading: “In addition to the standard assertions we listed back on page 203, additional function test assertions…”

    The use of both “In addition” and “additional” sounds redundant.

    2008-08-18
    210SUGGEST

    Description for assert_dom_(not_?)equal:
    “Because the assertion compares a normalized version of both strings it is fragile in the face of application changes.”
    This seems a little fragile, logically. How about:
    “Because the assertion compares the complete (normalized) contents of both strings it is fragile in the face of application changes.”
    It’s fragile because it’s comparing the complete contents, not because it’s comparing the normalized contents.

    2008-08-18
    212OK

    assert_redirected_to description:
    “Asserts that the redirection options passed in match those of the redirect called in the last action.”
    How about:
    “Asserts that the redirection options passed in match those of the redirect RETURNED BY the last action.”

    (I’m assuming that at this point, we’ve gotten back one of the 3xx redirect responses, and haven’t actually followed it yet…)

    2008-08-18
    214OK

    follow_redirect description, at bottom:
    “If the preceding action generated a redirect, this method follows it by issuing a get request.”

    How about adding, “otherwise it does nothing” (if that’s the case)

    2008-08-18
    215TYPO

    example in with_routing description:
    Looks like the assert_equal call is indented too much (and doesn’t match its closing ‘end’)

    2008-08-18
    215OK

    Bottom paragraph describing HTML::Selector library:
    It looks like this library is described as working only for HTML and not XML in general. I’m curious why that is, since everything about it seems applicable to xml.

    2008-08-18
    217TYPO

    Every item in the “Chained Selectors” section shows “sel_1” (with no ‘s’) but ‘sel_2s’ (with an ‘s’). The ‘s’ seems out of place in each case.

    2008-08-18
    217OK

    Description for “sel_1 + sel_2s” says “immediately follow”. The comment right under it just says “follow”. How about changing that to “immediately follow”.

    2008-08-18
    217OK

    Last item on page, “sel1, sel_2s” seems a little out of place lumped in with “chained slectors”, which are described as describing “relationships between elements”. There’s no relationship between elements that is described by this selector.

    2008-08-18
    218OK

    Every one of the pseudoclasses describe on this page and the next (219), except the first two, describe the selector as if it were a strict parent-child relationship and not a looser ancestor-descendant relationship, despite the fact that the two simple selectors in each case are separated by a space (which pg 217 says means ‘ancestor’) and not a ‘>’ (which pg 217 says means ‘parent’).

    Do we need ’>’s in all these examples to make the descriptions match? Or do pseudoclasses operate a little differently? There’s no mention here either way.

    If the ‘>’ is needed, that would also affect the example on pages 215 and 221.

    2008-08-18
    218OK

    :nth-child description:
    “Contrast this with nth-of-type, described later.”

    This is a bit confusing - what are we supposed to be contrasting here? Since this comes right after the mention that “n counts from 1”, it could be suggesting that in nth-of-type, n doesn’t count from 1. Consider removing this, and/or adding “counting from 1” to the description for nth-of-type.

    2008-08-18
    218OK

    only-of-type description (bottom):
    “Selects all sel_2 nodes that are the only children of sel_1 nodes.”
    Add: “of type sel_2”

    2008-08-18
    219OK

    Near bottom: “Finally, you can invert the sense of any selector.”
    How about “invert the meaning” or simply “invert”

    2008-08-18
    219OK

    Bottom line:
    div :not(p) # all the non-paragraph nodes of all divs

    How about “all the non-paragraph child nodes” or “all the non-paragraph descendant nodes” (depending on which is correct)

    2008-08-18
    220OK

    Top: “Now we know how to select nodes in the response, let’s see…”
    How about: “Now THAT we know how to select nodes in the response, let’s see…”

    2008-08-18
    220OK

    About 3/4 down page:
    :count => n Exactly n nodes must have been selected.

    I’m wondering here: Can a range be passed to count as with the non-hash example of calling assert_select above:

    assert_select “div#main div.entry”, 1..10 # one to 10 entries on a page

    2008-08-18
    221OK

    Near top:
    assert_select “div#cart”

    This seems unnecessary, since this would be covered by the other two asserts following this one.

    2008-08-18
    221SUGGEST

    Near bottom:
    “When you create a model or controller, Rails creates the corresponding unit and functional tests.”

    Wondering if this should be:
    “When you create a model or controller, Rails creates the corresponding unit OR functional test.”

    since a model would get a unit test and a controller would get a functional test, but neither would get both. (Not sure here)

    2008-08-18
    221SUGGEST

    Near bottom:
    “Integration tests are not automatically created, however, so you’ll need to use a generator to create one.”
    How about:
    “Integration tests are not automatically created, however, but you can use a generator to create one.”

    (since you don’t need to use a generator, and it doesn’t seem to be doing much anyway in this instance)

    2008-08-18
    223ERROR

    End of 3rd paragraph:
    “The test helper method post_via_redirect generates the post request and then follows any redirects returned until a regular 200 response is returned.”

    How about changing the ending to something more like:
    “…follows any redirects returned until a NON_REDIRECT response is returned.”

    2008-08-18
    226OK

    In the regular_user code example, in the user.checks_out method, it takes the items in the ‘details’ hash that was passed in, and then uses them to rebuild an identical hash to pass as the :order parameter.

    This could be replaced with “:order => details” as is done in the performance test example at the top of page 232.

    2008-08-18
    226OK

    Bottom of page: “For example, here’s a test that verifies that there’s no interaction between two users buying products at the same time.”

    A little strong perhaps? I doubt this “verifies” that, but it certainly could uncover a problem along those lines…

    2008-08-18
    227TYPO

    Big paragraph near bottom:
    “However, you can also create explicit sessions (using the open_session method) and invoke these methods on it directly.”

    How about:
    “However, you can also create explicit sessions (using the open_session method) and invoke these methods on THEM directly.”

    2008-08-18
    227TYPO

    Bottom:
    “Integration test sessions have the following attributes.”
    How about something like:
    “Integration test sessions have a collection of attributes.”

    (they don’t ‘follow’ quite yet - not til after an example and another mention of ‘the list that follows’)

    2008-08-18
    228OK

    cookies description:
    “A hash of the cookies.”
    How about:
    “A hash of the cookies kept by the simulated client.”

    2008-08-18
    228SUGGEST

    description for ‘host’:
    “Set this value to the host name to be associated with the next request.”
    How about:
    “Set this value to the SERVER host name to be associated with the next request.” (as opposed to the client host name)

    Same for the description for ‘remote_addr’ farther down:
    “The IP address to be associated with the next request”
    How about:
    “The SERVER IP address to be associated with the next request”

    (Sam says: Actually, remote_addr refers to the client)

    2008-08-18
    228OK

    description for ‘request’ and ‘response’ attributes:
    Both of these are said to be “used by the last request.” How about “associated with the last request.”?

    2008-08-18
    228SUGGEST

    descriptions for ‘status’ and ‘status_message’ attributes:
    Both say “status code of the last request”.

    How about changing ‘request’ to ‘response’ in both of these, since it’s the response that has the status code.

    2008-08-18
    229SUGGEST

    Interesting that the follow_redirect!() function has a ‘!’ in its name, while the (.+)_via_redirect functions farther down, which do the same thing (I think*) don’t have a ‘!’ in their names.

    *The description for follow_redirect!() has no mention of following possible subsequent redirects, as the other methods I mentioned do. Does this method follow subsequent redirects or not?

    2008-08-18
    229TYPO

    xml_http_request description:
    “Performs a HEAD, GET, POST, or PUT, DELETE, or XML_HTTP request with the given parameters.”

    How about:
    “Performs a HEAD, GET, POST, PUT or DELETE, for an XmlHttpRequest using the given HTTP method.”

    As it stands, the first ‘or’ seems out of place, the second I’m guessing should be ‘for’, and the ‘XML_HTTP’ seems to belong in there as one more HTTP method name.

    It would also be nice to have a brief mention of what makes an ‘xml’ http request different (unless I’m mistaken, it’s just an extra header that browsers happen to set when they’re acting on a javascript call).

    2008-08-18
    229SUGGEST

    description for (.+)_via_redirect(path, args={}) functions:
    What’s the ‘args’ parameter here? Is it the same thing as the ‘params’ parameter in the methods listed right above these? Also, why can you pass headers to that set of functions but not to this set?

    2008-08-18
    229ERROR

    Description for ‘open_session’:
    “Creates a new session object. If a block is given, pass the session to the block; otherwise return it.”

    Isn’t the session returned either way (not ‘otherwise’)? The example on page 226 seems to depend on this…

    2008-08-18
    229OK

    ‘reset!()’ description (at bottom):
    I’m wondering here how this resets the session. For example, does it clear the session variable used by controllers?

    2008-08-18
    230SUGGEST

    Start of 6th paragraph: “In the old days (yes, that was last year)”

    I assume this is from the 2nd (or first!) edition? What year are we talking about?

    2008-08-18
    231OK

    3rd paragraph: “Now we need to write a performance test. Again, we want to keep them separate”

    How about: “…keey THESE separate”

    2008-08-18
    231ERROR

    Example showing order_speed_test.rb:

    In the first two ‘require’ lines, do we need all this rather than “require ‘test_helper’”? as on page 205? In other words, does the new convention described back there not apply to performance tests?

    And these next two lines…

    1. Reraise errors caught by the controller.
      class StoreController; def rescue_action(e) raise e end; end

    I’m a little lost there - is this bit of code changing anything? It looks like anything it catches and reraises would have bubbled down in the same way if this code weren’t there. I don’t see any description of what purpose this code is serving.

    Also, is there a reason the OrderSpeedTest class is inheriting from Test::Unit::TestCase and not ActionController::TestCase?

    2008-08-18
    233ERROR

    In the first paragraph, we have ‘script/profiler’ and ‘script/benchmarker’ but in the examples that follow we have ‘script/performance/profiler’ and ‘script/performance/benchmarker’

    2008-08-18
    234OK

    Near bottom: “This subdirectory holds all the stub files that are used in the test environment. If we wanted to stub out files while in the development environment, we’d have put our stubs in the directory test/mocks/development.”

    I’m wondering at this point: does this mean the contents of test/mocks/development are checked before other locations while in development mode? And the contents of test/mocks/production will take precedence over other loacations while in production mode?

    2008-08-18
    235OK

    Speaking of how the ‘mocks’ we’re using are really stubs, how about including mocks into the narrative rather than just mentioning them as a couple footnotes.

    2008-08-18
    285OK

    Listing of foreign_key helper is partly coloured green (after hash signs) what is a bit misleading because these are not comments in fact.

    (Dave says: Our syntax highlighter can get confused—there’s no much we can do about it without including a full Ruby parser, which just isn’t practical)

    2008-12-26
    290SUGGEST

    It would be useful to change the schema version in the listing showing Schema Information added by “rake annotate_models” because currently it looks a bit different (i.e. 20080816214522).

    2008-08-18
    339TYPO

    The :dependent option tells Active Record what to do to child rows when you
    destroy a row in the parent table. It has five possible values.

    should be

    The :dependent option tells Active Record what to do to with child rows when you
    destroy a row in the parent table. It has five possible values.

    2008-08-18
    289SUGGEST

    Regarding this: “You’ll need to research on
    your own how to make a migration run in production—I’d rather not say here.”

    It would be helpful to point to specific places to research this, as it seems to be critical piece to understand for deployment. One reference is the “Deploying Rails Applications” book, but I’d like to see other references as well.

    2008-09-23
    185ERROR

    Adding “:xml => @product.to_xml(:include => :orders)” to format.xml will generate more verbose output (basically, a record dump) than is indicated in the book. The books shows what the output would be if the “:xml” argument was left out.

    2008-08-18
    542TYPO

    The phrase “which we’ll discuss Section 23.1” should be “… discuss in Section 23.1” .

    2008-08-18
    137OK

    depot> ls -p app/helpers
    application_helper.rb products_helper.rb store_helper.rb

    The Rails generators automatically created a helper file for each of our controllers (produts and store).

    NOTE: “(PRODUTS and store)”

    (Sam says: fixed in Beta 1.4)

    2008-09-23
    2TYPO

    7 lines from the bottom, “overide” should be “override”

    2008-09-23
    103TYPO

    Bottom: “the add_to_cart doesn’t exist yet”
    How about: “the add_to_cart ACTION doesn’t exist yet”

    2008-09-23
    103SUGGEST

    List item 5: “Create a simple stylesheet.”

    We created the stylesheet in the previous chapter. In this chapter, we just updated it.

    2008-09-23
    104SUGGEST

    List item 5: “Create a simple stylesheet.”

    We created the stylesheet in the previous chapter. In this chapter, we just updated it. (ps - and that was part of step 7 (add a button…))

    2008-09-23
    211TYPO

    “So, to post a form to the edit action containing User model data…”

    but the example (post :create) shows a post to the create action, not the edit action

    2008-09-23
    85TYPO

    You can fix this by deleting a the h that appears

    2008-09-23
    98OK

    The question is regarding the line in the index.html.erb code:

    <% for product in @products -%>

    First, you might want to explain with the minus is doing in there (removing whitespace apparently). And second, isn’t there supposed to be one at the opening of the line, e.g.:

    <- for product in @products ->

    I’m new to all of this, so I had to google what the erb tags are, and what they do.

    (Sam says: Covered in section 4.2 on page 54)

    2008-09-23
    437SUGGEST

    The paragraph that begins: “The extras parameter again contains…” pertains not to the previous example but the previous-1 example. It seems a bit out of place.

    2008-09-23
    439OK

    In explaining the process of finding a method for the action this line is the first “or-else” part. At best it is awkward. But I think it is also out of place. “If not, but the controller implements method_missing, that method
    is called, passing in the action name as the first parameter and an empty
    argument list as the second.”
    The logic would be that a “method” is sought to match the “action”, if not “If no method can be called, the controller looks
    for a template named after the current controller and action. If found, this
    template is rendered directly.”
    Now the text says that “an “Unknown
    Action” error is generated“. My suspicion is that the ”method_missing" method is called with the action which does some logging and then raises the error.
    Oh one strange note. My PDF copy does not have any footer on the bottom of page 439???

    2008-09-23
    439OK

    “hide_action” is only discussed on this page in a chapter on how the controller processes incoming action requests. The text mentions that it hides a public method that you don’t want to be private. The text indicates that this might occur for a method that is put in a library. There is sparse information about library modules in this text. The index points to “/lib” directory for a little assistance. But the above “hide_action” is not mentioned there.
    IMHO “hide_action” should be discussed with “private” and “public” sections of a module/file as well as the “/lib” area.
    And a couple of questions that all this raises: Does the controller parsing function try to find the “action” in a list of “public” actions that are not in the “/lib” directory? Do all methods in libraries need to be put after “hide_action”??

    2008-09-23
    442OK

    “See the documentation of ActionController::AbstractRequest for full details.” appears near the top of the page and after a code block (“class BlogController”). This code block seems quite unnecessary as it only references 2 of the 20 odd request attributes that have been mentioned in the previous 1.5 pages.

    2008-09-23
    443SUGGEST

    In the paragraph: “By convention, the template for action action of controller control will be in the
    file app/views/control/action.type.xxx (where xxx is one of erb, builder, or rjs). The
    app/views part of the name is the default. It may be overridden for an entire
    application by setting
    ActionController::Base.template_root =dir_path” —- control, action and xxx are described but nothing is said about “type”

    2008-09-23
    439OK

    Sorry about the previous post on method_missing. On 444 text explains that method_missing is only called if in development mode. The wording here is still awkward.

    2008-09-23
    132TYPO

    At the bottom ‘Note’ part, in item 3 at the first line ‘but it simply is a a method call which is passing’, there are 2 letters of ‘a’.

    2008-09-23
    140OK

    I use NetBeans 6.1 to try this depot application. The browser I used is Firefox 2.0. After I disable the browser’s javascript (in Firefox, Tools -> Options -> Uncheck ‘Enable JavaScript’), I didn’t see an error message even the cart is empty. But the highlight visual effect doesn’t work. Once javascript is enabled in the browser, everything is working.

    (Sam says: The highlight visual effect requires JavaScript. I’m unclear what error message you were expecting to see when the cart is empty.)

    2008-09-23
    70SUGGEST

    It shows:
    work> cd depot
    depot> ls -p
    I’m using the Ruby console window opened from Instant rails.
    I get, “ls is not recognized ,,,” dir works ’so it makes me wonder whether I’m doing things correctly (which I find desperately important when I’m feeling my way around!).
    Should it show, “.. or dir in Windows”?

    2008-09-23
    566ERROR

    closing div is missing

    2009-02-24
    108SUGGEST

    “Next, we have to tell Rails to use database storage for our application”
    How about:
    “Next, we have to tell Rails to use database storage for our application SESSIONS”

    2008-09-23
    108SUGGEST

    Maybe this isn’t the place to mention this, since here the book is quoting directly from Rails’ environment.rb file, but in the section that reads, “Use the database for sessions instead of the cookie-based default”, shouldn’t “cookie-based” be “filesystem-based”?

    What we’re changing by uncommenting this setting is where the server is keeping its sessions. Either way, we’re using cookies to store session ids right?

    2008-09-23
    108SUGGEST

    2nd-to-last paragraph:
    “cookies are stored on the browser by name.”
    How about something like:
    “cookies are stored on the browser by server hostname.”

    2008-09-23
    116SUGGEST

    On pages 116-118, exceptions are said several (I noticed seven) times to be ‘thrown’ rather than ‘raised’. Other languages use this terminology all the time, but the Pickaxe book makes a distinction between ‘raising’ exceptions (handled with ‘rescue’) and ‘throwing’ symbols (handled with ‘catch’).

    I’m not sure if the two are interchangeable (eg you can rescue something that you throw, or catch something that you raise) but it would seem more consistent with the pickaxe book if these uses of ‘throw’ (or ‘throws’, ‘thrown’ etc) were changed to ‘raise’.

    2008-12-30
    119OK

    Footnote 6: “It’s often a good idea to keep a window open showing new lines as they are added to this file.”

    I’ve noticed that when keeping a window open with a log as described here and another with the output from script/server, much of the same information shows up in both. I’m not clear on what the difference is between the two, or if one has a superset of the information in the other.

    2008-09-23
    120TYPO

    “We’ll also need a new CSS styling for the notice box.”
    Should this be, “We’ll also need a new CSS styling RULE for the notice box.”?

    2008-09-23
    123SUGGEST

    In the “What We Just Did” bullet list:
    “Using the flash to pass errors between actions”
    How about:
    “Using the flash to pass errors and other messages between actions”

    2008-09-23
    113TYPO

    2nd paragraph:
    “We see whether our list of items already includes the product we’re adding; if it does, we bump the quantity, and otherwise we add a new CartItem.”

    How about:
    “WE’LL see whether our list of items already includes the product we’re adding; if it does, WE’LL bump the quantity, otherwise WE’LL add a new CartItem.”
    (removed extra ‘and’)

    2008-09-23
    86TYPO

    Be careful as you add methods to this con-
    troller as we work further on the product

    should be “model”

    2008-09-23
    114TYPO

    Start of last paragraph:
    “Now if you hit Refresh, and you’ll see a different error”
    How about:
    “Now if you hit Refresh, you’ll see a different error”

    2008-09-23
    123SUGGEST

    In the first “playtime” item:
    “Add a new variable to the session to record how many times the user has accessed the index action.”
    How about:
    “Add a new variable to the session to record how many times the user has accessed the store controller’s index action.”

    2008-09-23
    129SUGGEST

    Footnote: “And if you’ve updated your CSS appropriately… See the listing on page 692 for our CSS.”

    I think the CSS needed for this change (adding the cart to the sidebar) is already in the CSS file I downloaded earlier. There’s already a section in it called “Styles for the cart in the sidebar”.

    2008-09-23
    132TYPO

    Footnote 3: “it simply is a a”
    How about: “it is simply a”

    Also: “We will cover respond_to method”
    How about: “We will cover THE respond_to method”

    2008-09-23
    133TYPO

    End of 1st paragraph: "the content of

    "
    How about: "the content of THE

    "

    2008-09-23
    134TYPO

    Top: “what Microsoft call quirks mode”
    How about: “what Microsoft CALLS quirks mode”

    2008-09-23
    167SUGGEST

    Adding a user did not work for me until I restarted my server. I don’t know why. Is RESTful routing not correctly generated until the server restarts? This is a very confusing issue.

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    137TYPO

    3rd paragraph:
    “Because the add_to_cart template is invoked only when we add something to the cart, THEN we know that we have to…”
    (emphasis on THEN added - I don’t think it belongs)

    2008-09-23
    140SUGGEST

    Last paragraph: “So, on the server, we can tell that we’re talking to a JavaScript-enabled browser by testing to see whether the incoming request was generated by an xhr object. And the Rails request object, available inside controllers and views, makes it easy to test for this condition: it provides an xhr? method.”

    It would be nice to de-mystify xhr requests a bit and say what is actually different about these types of requests. I think it’s one of the HTTP headers?

    2008-09-23
    271TYPO

    “deterministically ordered far outways the miniscule risk of this occuring.” should read “deterministically ordered far outweighs the miniscule risk of this occuring.”

    Outweighs is misspelled.

    2008-09-23
    145SUGGEST

    There’s an example of the Order class with a “#…” seemingly suggesting that other stuff follows the line “has many :line_items”. But at this point, there’s nothing else in that file.

    2008-09-23
    146TYPO

    2nd paragraph: “belongs_to tells Rails that rows in the line_items table are children of rows in the orders and products tables: the line item cannot exist unless the corresponding order and product rows exist.”

    Should “the line item cannot exist” be “a line item cannot exist”?

    2008-09-23
    146TYPO

    Last paragraph: “Now we have our tables and our models, we can…”
    How about: “Now THAT we have our tables and our models, we can…”

    2008-09-23
    154TYPO

    Footnote 6: “You can save yourself some keystrokes on commands like these by creating a file named .sqlite3rc and put it in your home directory.”

    “put” should be “putting”
    Also, should this file be in your home directory? Or the project’s root directory? A relative path like db/development.sqlite3 makes no sense if referenced in a file in the developer’s home directory…

    2008-09-23
    122OK

    I haven’t tried this yet, but, surely instead of using number_to_currency() twice in add_to_cart.html.erb and once in index.html.erb, this would be better placed in the models, as per your suggestions earlier in the book.

    I only spotted this because way back I had set a currency other than dollars in my index.html.erb, so my catalog was showing dollars and my cart pounds.

    By the way the book rocks!

    2008-09-23
    130OK

    end statement from previous code block has become separated by figure 9.1

    (Dave says: we’ll fix this during layout)

    2008-12-30
    150TYPO

    3rd paragraph: “Add a little CSS magic (see the listing in the appendix)…”

    Doesn’t seem necessary. The CSS downloaded earlier on gives me the same thing shown in Figure 10.2.

    2008-09-23
    136OK

    There is no download link for the code associated with Iteration D4:Hide an Empty Cart. Also there are no triangle shaped pointers showing which lines have been modified.

    (Sam says: The next paragraph says “So let’s not use this code”)

    2008-09-23
    139TYPO

    Code block that starts def empty_cart should have a triangular pointer next to line redirect_to_index showing this line has changed

    2008-09-23
    141SUGGEST

    In section 9.6 you talk about using FF and Safari, one with JS on and one with JS off. I’m not favouring (yeah, I know British spelling) one over the other but FF has a massively popular add-on called NoScript that makes checking JS/no JS a one-click breeze.

    2008-09-23
    149OK

    Curious why error_message_for uses ‘order’ (a string) but form_for uses :order (a symbol)

    2008-09-23
    157SUGGEST

    2nd playtime item:
    “Hint: variables set in the controller are available in the layout as well as in the directly rendered template.”
    How about:
    “Hint: variables set in the controller are available in LAYOUTS AND PARTIALS as well as in the directly rendered template.”

    (The simplest way I came up with to solve this one was accessing a variable from a partial, not a layout.)

    2008-09-23
    166SUGGEST

    The code shown for the new user form “app/views/users/new.html.erb” looks significantly different than what I see after generating the file with the scaffold script. I am suspicious that the code shown in the book is from an older version of rails. I’m using rails 2.1.0. and scaffold creates code that looks like this:

    New user

    <% form_for(@user) do |f| %>
    <%= f.error_messages %>

    <%= f.label :name %>

    <%= f.text_field :name %>

    <%= f.label :hashed_password %>

    <%= f.text_field :hashed_password %>

    <%= f.label :salt %>

    <%= f.text_field :salt %>

    <%= f.submit “Create” %>

    <% end %>

    <%= link_to ‘Back’, users_path %>

    I think it would be less confusing if the code in the book was changed to more closely follow what is currently generated by scaffold.

    2008-09-23
    150SUGGEST

    At the top of page 150, the book claims there’s only one tricky thing about the form code on the previous page (149). However, I was perplexed by another issue which is why was the object so important to a label. Why did a label even care? Now that I look at the underlying code, I realize that the label uses the object as a namespace to prefix onto the names of the fields, presumably so one form can use multiple object with similar fields. I believe page 150 would be a great place to mention that potential stumbling block for curious but web-inexperienced readers.

    Thanks. Great book by the way. :-)

    2008-09-23
    161TYPO

    Opening line (grammar): Shouldn’t it be “If it weren’t for…” as subjunctive (instead of “If it wasn’t for…”)?

    2008-09-23
    179SUGGEST

    Addition to “What We Just Did”?

    We unified our layouts into a single application-wide layout in the ApplicationController class in the file application.rb in app/controllers.
    [i.e., on page 174.]

    2008-09-23
    166TYPO

    Code sample appears truncated

    <%= link_to ‘Destroy’, user, :confirm => ‘Are you sure?’, :method => :delet…TRUNC

    2009-01-02
    158SUGGEST

    Near bottom: “This time, we’ll use a little rails magic when we create the model. We can give a list of columns and types, and Rails will fill in the migration for us.”
    (script/generate scaffold example folllows)

    We actually started out the depot application with one of these, way back on page 77

    2008-09-23
    160OK

    string_to_hash = password + “wibble” _ salt

    What useful purpose could the “wibble” in the middle possibly be serving?

    2008-09-23
    161TYPO

    Paragraph in middle: “Because the incoming password is in plain text, we have to read the user record using the name as a key then use the salt value in that record to construct the hashed password again.”

    How about: “…using the name as a key AND then use the salt value…”

    2008-09-23
    164SUGGEST

    2nd paragraph: “It defines the standard methods to index, show, create new and edit users.”

    Do we want update and destroy in this list?

    2008-09-23
    164TYPO

    2nd paragraph: “So lets avoid the redirect…”

    How about “let’s” instead of “lets”

    2008-09-23
    165TYPO

    Last paragraph: “After clicking Add User, the page is redisplayed with a cheery flash notice.”

    It looks like the code handling this (on pg 165) redirects to the index (rather than redisplaying the form).

    2008-09-23
    168SUGGEST

    It looks like the login method shown here (and again on page 173) will log the user out with that first line, “session[:user_id] = nil” after the simple act of viewing the login page. It doesn’t check for a POST request until afterward, meaning a GET will have the side effect of logging the user out (I read RESTful Web Services - GETs shouldn’t have side effects!)

    How about moving that statement inside the “if request.post?”

    2008-09-23
    172TYPO

    In the listing for application.rb, the first line (“before_filter…”) has a colored arrow next to it showing that it’s a new addition, but the authorized method at the bottom (also new) doesn’t.

    2008-09-23
    173OK

    “A Friendlier Login System” sidebar, 3rd paragraph:
    “We also need to clear down that stored URI once used.”

    Was this meant to be “clear out” rather than “clear down”?

    2008-09-23
    167ERROR

    Not sure why “Enter User Details” shows up twice in the figure - the view code seems to use it only once, as the ‘legend’ tag.

    2008-09-23
    184TYPO

    typo: “Within an builder template”… -> “Within a builder template”.

    2008-09-23
    179OK

    Footnote: “Later, in Section 16.4, Data Migrations, on page 282, we’ll look at options for populating database tables as part of a migration.”

    These were first introduced in iteration A4, but this note makes it sound like it hasn’t been mentioned yet

    (Sam says: Not quite. There is a subtle distinction between populating the database schema and populating the tables themselves.)

    2008-09-23
    173TYPO

    “Navigate to http…/admin/. The filter method intercepts us on the way to the product listing”

    Shouldn’t be “http…/products” instead ?

    2008-09-23
    175TYPO

    Shouldn’t it be “<%= link_to ‘Orders’, :controller => ‘admin’ %>” rather than “<%= link_to ‘Orders’, :controller => ‘orders’ %>” ?

    (Same says: Next beta will generate the orders controller)

    2008-12-26
    103OK

    In the citation of the depot.css seems to be a partial duplication of text:

    #store .entry form, #store .entry form div {
    display: inline;
    }

    (Sam says: That’s actually correct CSS)

    2008-09-23
    641SUGGEST

    “The second, lib/tasks/capistrano.rake, adds some tasks to your application so that you can directly call Capistrano tasks using Rake.”
    This second file is not created on my system (Using Debian-Etch, Rails 2.1, rubygems 1.2). Maybe it is not added everytime for some reason?

    2008-12-30
    198SUGGEST

    Updating the default fixture for products.yml because with rails 2.1.0 I have this:

    one:
    title: MyString
    description: MyText
    image_url: MyString

    two:
    title: MyString
    description: MyText
    image_url: MyString

    2008-09-23
    236OK

    Would it be possible to show how making the stubbing method gateway.collect returning true in a first test case and false in another one ? Is there a dynamic solution rather than “return true” ?

    Thanks.

    2008-09-23
    181SUGGEST

    2nd paragraph: “What it [REST] really means is that you use HTTP verbs (GET, POST, DELETE, and so on) to send requests and responses between applications.”

    Don’t think “and responses” belongs, since responses don’t use HTTP verbs. I suppose the response equivalent would be status codes…

    2008-09-23
    187TYPO

    Near top: “We’ll explain why this works on page 434- - -for now, just take it on faith.”

    This is rendered as three short dashes. I’m guessing it’s meant to be one long dash?

    2008-09-23
    177SUGGEST

    The after_destroy method only seems to do its job if it’s public. I got briefly caught by that one, might be worth a mention.

    2008-09-23
    97OK

    After generating the store controller but before trying localhost:3000/store, config/routes.rb needs to be updated to map.resources :products, :store

    (Sam says: Not true, store is not a resource, instead it depends on the default routes)

    2008-09-23
    249TYPO

    “The app/controllers directory and its subdirectories.
    • All directories whose names start with an underscore or a lowercase letter under app/models.
    • The directories app, app/models, app/controllers, app/helpers, app/services, config, lib, and vendor.”

    Seems like you say “app/controllers” and “app/models” directories are included twice…

    2008-09-23
    330SUGGEST

    The last paragraph on the page, before the list of special column names starts; A number of column names that have special significance to Active Record.

    Should it read; There are a number of column names that have special significance to Active Record.

    2008-09-23
    71SUGGEST

    If you’re using Firefox browser you should give a try to an add-on called SQLite Manager; great for administering our db, tables etc.

    2008-09-23
    197TYPO

    On bottom of page, inside the following method:

    bad.each do |name|
    product = Product.new(:title => “My Book Title”, :description => “yyy”, :price …TRUNC
    :image_url => name)
    assert !product.valid?, “saving #{name}”
    end

    TRUNC should be replace with => 1

    2009-01-02
    109OK

    The file depot_f/app/controllers/store_controller.rb already contains the add_to_cart action, even though that is yet to be added to the store controller.

    (Sam says: oreshadowing :-) More seriously: a lot of changes to a small number of files are happening in a short period of time here, and while more snapshots could be taken, it wouldn’t help in understanding.)

    2008-09-23
    113OK

    It would help if you provide some explanation of how @items.find works in this case, or just provide the relevant page number in the Ruby documentation at the end of the book. Thanks.

    2008-09-23
    497TYPO

    paginate words just like find–it just
    doesn’t fetch all of the records.

    I believe you want paginate works just like find — it just …

    2008-09-23
    37TYPO

    “until you deside it is time to upgrade.”

    2008-09-23
    88OK

    The footnote on this page flows over to the next page’s footnotes.

    (Dave says: We fix stuff like this during layout (although footnotes do indeed sometimes break across pages)

    2008-12-30
    93OK

    You might want to add a bullet for the Rails helper method image_tag as well.

    2008-09-23
    308TYPO

    The comment “# get the limit amount from the form” should be “# get the name from the form”

    2008-09-23
    127OK

    “That’s because the render method in the main template arranges to set a variable with the same name as the partial template to the current item each time around the loop.”

    It’s not entirely clear that the ‘loop’ in this case is implicit, and not explicitly coded.

    2008-09-23
    33TYPO

    Second bullet point says the book uses ‘Rails version 2.0 (specifically the 2.1 Rails RubyGem)’

    2008-09-23
    171TYPO

    I had to restart my server after adding the admin controller, I didn’t notice you mention that.

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    637SUGGEST

    You might want to update footnote 1 to indicate that Capistrano also supports Git.

    2008-09-23
    185OK

    I think it would be nice to have one of the triangles showing which line is new for the code at the very bottom of this page. (code for: depot_r/app/controllers/info_controller.rb)

    (Sam says: The whole body of the method is new)

    2008-09-23
    432TYPO

    The first paragraph after the “rake routes” listing (with a nested articles->comments routing):

    The book says “Note that the named route for /articles/:article_id/comments/:id is article_comments, not simply comments.” when in fact the name of the route should be “article_comment”, in singular (as it is in the listing). Also note that the following subordinate clause should also have the singular form “not simply comment”. Minor errors indeed. :)

    2008-09-23
    80SUGGEST

    Bump the class def code snippet to the next page after the “Prices, Dollars, and Cents” sidebar — it’ll be a lot clearer to the reader what’s going on.

    2008-09-23
    340ERROR

    :dependent => false (or nil) to prevent child row from being updated or deleted when parent is destroyed does not seem to be supported in Rails 2.1 (nor edge at the moment). The same goes for the has_many association.

    Normally when using a database schema with synthetic ids this might not be a big loss, but when using a legacy database with natural keys it often is…

    2008-09-23
    202OK

    I found the placement of the code fragment (fig 13.1) at the top of this page (@@default_error_messages = …) confusing, especially when it follows the sentence “The complete file now looks like this.” I think the book would be clearer if it was moved closer to where it is relevant, or better separated from other pieces of code.

    (Dave says: we handle this during layout when the book is finalized)

    2009-01-26
    89SUGGEST

    the part :message=> ‘must be a URL for GIF, JPG ’ + ‘or PNG image.(gif|jpg|png)’ would be a lot more tidy without the last part (gif|jpg|png), which is confusing for non-geek end users of our app.

    2008-09-23
    275SUGGEST

    Maybe you should precise that the name of the file is important when you create a migration and that it should have the same name as the class, isn’t it?
    And you should precise that in this case the views and layout won’t be upgraded (it should be done manually).
    thank you very much for your book, it’s very good at all.

    Best Regards
    Maxime

    Sorry for my english but I’m french, you can email me at helfer.m@free.fr if you have some questions.

    2008-09-23
    679TYPO

    The “this line has changed” triangle appears here and seems out of place since this is the listings appendix.

    2008-09-23
    681TYPO

    The “this line has changed” triangles appears here and seem out of place since this is the listings appendix.

    2008-09-23
    683TYPO

    The “this line has changed” triangles appear here and seem out of place since this is the listings appendix.

    2008-09-23
    185OK

    per previous comment, add the triangle to the

    format.html

    line that was added for the change that was just made.

    2008-12-30
    199SUGGEST

    Seems like the following line should be bold, italics, underlined, flashing, and otherwise drawing attention to itself:

    Although it isn’t obvious in print, you must use spaces, not tabs, at the start of each of the data lines, and all the lines for a row must have the same indentation

    2008-09-23
    240TYPO

    Top:
    “Once you have files in the lib directory, you use them in the rest of your application.”

    How about:
    “Once you have files in the lib directory, you CAN use them in the rest of your application.”

    2008-09-23
    240TYPO

    2nd paragraph:
    “If the file is in the lib directory itself, you require it directly by name.”

    How about:
    “If the file is in the lib directory itself, you CAN require it directly by name.”

    2008-09-23
    240TYPO

    In the code sample near the bottom of this page, the ‘puts’ statement isn’t indented inside the do..end block

    2008-09-23
    243TYPO

    Middle paragraph: “Early ones may only be compatible only with earlier versions of Rails…”

    Using “only” twice here sounds redundant

    2008-09-23
    244OK

    “If you want to go back to the system-wide versino of Rails, you can either delete the vendor/rails directory or run the command ‘rake rails:unfreeze’”

    This has me wondering if these two are equivalent. My guess based on this passage is that they are.

    2008-09-23
    244TYPO

    3rd paragraph:
    “This is less risky than having your project dynamically update as the core team make changes each day…”

    How about:
    “This is less risky than having your project dynamically update as the core team MAKES changes each day…”

    2008-09-23
    244OK

    “rake rails:freeze:edge”

    I assume from the earlier discussion that this command will put a copy of the latest version of edge rails in vendor/rails?

    2008-09-23
    245OK

    Top: “Running on the Edge means getting all the latest improvements and techniques as they emerge from extraction.”

    I’m wondering what is meant here by “extraction”

    2008-09-23
    248TYPO

    Near top:
    “…it arranges to load itself from there, rather from the shared library code.”

    “…it arranges to load itself from there, rather THAN from the shared library code.”

    2008-09-23
    250ERROR

    Outdated references to .rhtml, .rxml in Figure 14.3

    2008-09-23
    253TYPO

    Footnote 3: “With gems, usegem install…” appears to lack a space between “use” and “gem”

    2008-09-23
    256OK

    “Rails extends all Ruby objects with the blank? method. It always returns false for nil and false, and it always returns true for numbers and for true.”

    This description looks backward to me.

    2008-09-23
    261OK

    now = Time.now

    puts now.at_midnight # => Thu May 18 00:00:00 CDT 2006

    puts now.midnight # => Thu May 18 00:00:00 CDT 2006

    I’m wondering what the difference between these is…

    2008-09-23
    268OK

    Last sentence:
    “Your terminal man not display…”

    should be:
    “Your terminal MAY not display…”

    (Sam says: Fixed in B1.5)

    2008-09-23
    270SUGGEST

    The last paragraph on this page talks about the “apply” and “undo” parts of a migration. Should this be “up” and “down” instead?

    2008-09-23
    270OK

    Last paragraph:
    “If the current schema_migrations table has a row with a higher version numbers than this target number, Rails takes the migration with the highest version number…”

    How about:
    “If the current schema_migrations table has a row with a higher version NUMBER than this target number, Rails takes the migration FOR THE ROW with the highest version number…”

    2008-09-23
    270OK

    The misspelled “outways” mentioned in the errata for pg 271 is actually on pg 270.

    (Sam says: It’s on page 271 in B1.5)

    2008-09-23
    272SUGGEST

    End of 6th paragraph: “This is true even if the version number was before one or more of the already applied migrations. […] If we then run migrations this new migration file—and only this migration file—will be executed.”

    Really? Wouldn’t this lead to migrations applied out of order? Is this done because it is assumed that out-of-order migrations created this way will be independent of one another? Some mention of this issue might help…

    2008-09-23
    277TYPO

    3rd paragraph:
    “Rails migrations automatically add a primary key called id to all tables it creates.”

    How about:
    “Rails migrations automatically add a primary key called id to all tables THEY CREATE.”

    2008-09-23
    278ERROR

    The “create table tickets (…” DDL shown on this page seems to be missing the “updated_at” field.

    2008-09-23
    282OK

    3rd paragraph: “Note that we’re talking here about creating data that’s a convenience for the developer when they play with the application and for creating ”fixed" data such as lookup tables."

    …but page 284 says not to do this. It seems like we’re getting conflicting advice here. It seems like what we’d really want is something that does this in development-mode only…

    2008-09-23
    283OK

    The first code sample on this page creates the directory “db/migrate/dev_data”. I’m wondering if this is meant to imply a restriction to the development environment, as opposed to test or production. While that seems to be what we would want, it doesn’t appear to be what we’re doing in this example…

    2008-09-23
    284OK

    2nd paragraph: “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, and the like. Do not load test data into your application this way.”

    As mentioned in my comments on the last couple pages, this seems to put us back on square one, without a good way of loading test data for the development environment.

    2008-09-23
    292OK

    2nd paragraph:
    “By default, Active Record assumes that the name of the table is the plural form of the name of the class.”

    How about:
    “By default, Active Record assumes that the name of the table is the LOWERCASE plural form of the name of the class.”

    (Sam says: That varies by db. In DB2, for example, it is uppercase.)

    2008-09-23
    294SUGGEST

    2nd paragraph: “if the schema specifies columns with no decimal places, they are mapped to integers; otherwise they are mapped to Ruby BigDecimal objects…”

    Should “integers” be changed to “Fixnums” here? (since we’re mentioning the exact class in the decimal case)

    2008-09-23
    295TYPO

    Top: “If we fetched this row into an Active Record object, that object would have five attributes.”

    Looking at the example immediately above this, it looks like seven rather than five.

    2008-09-23
    298SUGGEST

    5th paragraph:
    “For example, the following call creates a connection to a SQLite3 database called railsdb on the server dbserver.com using the given user name and password.”

    This description looks like it hasn’t been updated in the move from MySQL to SQLite3, and doesn’t match the code example below it.

    2008-09-23
    305ERROR

    Last paragraph: “Note that in this case a RecordNotFound exception is returned if any of the ids cannot be found…”

    I assume this should say “raised” rather than “returned”?

    2008-09-23
    306TYPO

    “David Says” sidebar, first paragraph: “A call to Person.find(5) is based on our knowledge of the persons table.”

    This should be “people table” rather than “persons table” right?

    2008-09-23
    306OK

    2nd paragraph after sidebar:
    “So far we’ve just scratched the surface of find, using it to return one or more rows based on ids that we pass in as a parameter.”

    How about:
    “So far we’ve just scratched the surface of find, using it to return one or more rows based on ids that we pass in as PARAMETERS.”

    2008-09-23
    309SUGGEST

    Description for “:conditions”:
    “…whenever we talk about an SQL parameter, assume the method can accept either an array or a string.”

    How about adding “or a hash” to this statement?

    2008-09-23
    311TYPO

    2nd paragraph: “…have the question include the author name in the result set.”

    Why “question” rather than “query”?

    2008-09-23
    317TYPO

    In the first code sample on the third line, how about changing “order” to “orders” since it is doing a find_all

    2008-09-23
    321TYPO

    4th paragraph:
    “Both read the corresponding rows in the database table into model objects and call the instance-level destroy method of that object.”

    How about:
    “Both read the corresponding rows in the database table into model objects and call the instance-level destroy method of THOSE OBEJCTS.”

    2008-09-23
    330TYPO

    “xxx_id
    Default name of a foreign key reference to table named with the plural form of xxx”

    add an “a” or “the” before “table”

    2008-09-23
    333SUGGEST

    Bottom: “If you used some other name, you’ll need to add a declaration so Rails can find it.”

    How about saying how to do this, or pointing to a book or web site to find out more.

    2008-09-23
    335OK

    Under “One-to-One Relationships” heading:
    “…implemented using a foreign key in one row in one table to reference at most a single row in another table.”

    This seems like it would be more correct to say:
    “…implemented using a foreign key in AT MOST one row in one table to reference a single row in another table.”

    (moved “at most” to an earlier point in the sentence)

    2008-09-23
    336SUGGEST

    3rd paragraph:
    “…and the foreign key field is the singular form of the parent class name with _id appended”

    How about:
    “…and the foreign key field is the LOWERCASE singular form of the parent class name with _id appended”

    2008-09-23
    343TYPO

    “orders(force_reload=false)
    Returns an array of orders associated with this customer (which may be empty if there is none). The result is cached, and the database will not be queried again if orders had previously been fetched unless true is passed as a parameter.”

    How about:
    “orders(force_reload=false)
    Returns an array of orders associated with this customer (which may be empty if there ARE none). The result is cached, and the database will not be queried again if orders HAVE previously been fetched unless true is passed as a parameter.”

    (2 changes shown in caps)

    I just realized that all the errata submissions I made today up until now are for B1.4, whereas I submitted them as B1.5. Sorry, my bad.

    2008-09-23
    346TYPO

    3rd paragraph:
    “What do we do if we wanted…”

    How about:
    “What WOULD we do if we wanted…”

    2008-09-23
    346SUGGEST

    4th paragraph: “…the join table is not an Active Record object…”

    How about “model” rather than “object”

    2008-09-23
    354OK

    Example shows a find method on the Person model to find objects of classes that inherit from Person. I’m wondering if we can find managers in this table using Manager.find for example…

    2008-09-23
    354OK

    Bottom: “…access it via the model object’s indexing interface…”

    I’m wondering what the “indexing interface” is

    2008-09-23
    371OK

    2nd paragraph: “There’s an important point in this DDL…”

    but we’re looking at a migration here, not a DDL

    2008-09-23
    501TYPO

    Footnote 7 is unchanged from the 2nd ed of the book and is now out of date.

    2008-09-23
    173OK

    In section “Friendlier Login System”, perhaps we can augment and secure the statement “session[:original_uri] = request.request_uri” by writing “session[:original_uri] = request.request_uri if request.get?”. Thus, we make sure that only GET-method actions will be executed, and noone can “back-button” or bookmark or POST by hard-code or request later an inconsistent POST action.

    2008-09-23
    640TYPO

    Need to change the color of the “IDENTIFIED BY” line to indicate that the user typed it, and fix “somepass” and “some_pass” so they are the same.

    2009-02-24
    640TYPO

    Also, eliminate the semicolon at the end of the “GRANT ALL PRIVILEGES” line — there should only be one semicolon for this line, after the “IDENTIFIED BY” line. Indeed, if you use a semicolon after “GRANT ALL PRVILEGES”, you won’t be prompted for the rest of the line with the password.

    2008-09-23
    72OK

    The database.yml listing is not quite right. This is what Rails 2.1.1 generates when you have the —database=mysql option set:

    development:
    adapter: mysql
    encoding: utf8
    database: depot_development
    username: root
    password:
    socket: /tmp/mysql.sock

    (Sam says: The generator produces minor variations based on the platform, hence the “something like” on the page and “may or may not appear” on the next.)

    2008-09-23
    73OK

    I think this explanation might be a bit over-simplified: “(it’s called adapter because Rails uses this information to adapt to the peculiarities of the database)”. Technically, I think it’s called adapter because it’s named after the design pattern. Perhaps you should take out the parenthetical statement, or add a footnote that mentions the adapter design pattern and where to find more information about design patterns.

    2008-09-23
    75OK

    Here’s another somewhat likely problem that happened to me that can happen when users try rake db:migrate: an error happens that says you need to update RubyGems. I was running Rails 2.0.2 and when I upgraded to Rails 2.1.1 it told me that I needed to upgrade my RubyGems to at least RubyGems 1.1.1. A fair number of users may upgrade their Rails version before starting the depot application, so they would encounter this error.

    (Sam says: Covered in chapter 3)

    2008-09-23
    76SUGGEST

    It would be better style to change this sentence: “So, let’s go ahead and create the model and views and controller and the migration for our products table.” to be “So, let’s go ahead and create the model, views, controller and migration for our products table.”

    2008-09-23
    77SUGGEST

    In the first code listing on this page, it is difficult to distinguish between the user’s command and the resulting output. Use of color and bolding, such as in the listing on the bottom of the page, should help this.

    2008-12-31
    77OK

    It’s probably worth it to go into more detail on what Rake is (maybe put it in one of those gray text boxes you use when you take a little tangent so that you don’t interrupt the flow of the main idea).

    2008-09-23
    94OK

    Did you know that “whether or not” is redundant? You should just say “whether”. (Yes, this is picky ;)

    2008-09-23
    78OK

    The example uses WEBrick, which won’t be used if people type script/server with recent versions of Rails.

    (Sam says: Depends on what you have installed. See footnote 2 on page 46.)

    2008-09-23
    78OK

    The first paragraph under Run the Maintenance Application is too wordy. Consider replacing the whole thing with “First, we’ll start a local web server.”

    2008-09-23
    86ERROR

    “Be careful as you add methods to this controller” should be “be careful as you add methods to this model.” The text is talking about modification of the product model, not the controller.

    2008-09-23
    108ERROR

    I believe this statement is incorrect “the default is to use the filesystem”. As I understand it, in Rails 2 the default is to use cookies to store all of the session data, not just the session id.

    2008-09-23
    120OK

    You may want to mention that if you may not be able to see the new flash CSS styles until you hit refresh on your browser.

    2008-09-23
    154OK

    There is a great deal of troubleshooting advice mixed in with the Depot tutorial. It might be worth considering making a special sidebar for troubleshooting advice.

    2008-09-23
    189OK

    on an image I can see a beautiful output of the documentation - I wish there would be some instruction how to achieve this output (probably it’s all about providing a correct URI)

    (Sam says: Point your browser at the index.html file in the doc/app directory.)

    2008-09-23
    112OK

    After adding cart I get “ActionController::InvalidAuthenticityToken in Store#index ”

    from suggestion in #32678: I have tried to add:

    protect_from_forgery :only => [:create, :update, :destroy] after the class StoreController…. statement however this does not change the error message.

    I have downloaded and repalced my handwritten code with the examples provided.

    assistance appreciated … thank you

    Hugh Tucker

    (Sam says: If you restarted your browser, you need to back up to the form, hit refresh on that, and then proceed. This is covered on page 114.)

    2008-09-23
    233OK

    link to depot_r/test/performance/order_speed_test.rb lacks “setup” block of code.

    (Sam says: This specific test doesn’t require any particular setup.)

    2008-09-23
    233OK

    in code ~1/3 of page is line “{ :order => DAVES_DETAILS },” which takes details from hash which isn’t defined in this file (but is defined in downloadable one)

    (Sam says: From the text: “we’ll use the same hash of values we used in the integration test”. This hash was originally shown on page 227.)

    2008-09-23
    232OK

    in ~2/3 of page: “we’ll base the
    test on a standard functional test (and we’ll cheat by copying in the boilerplate
    from store_controller_test.rb)” - probably it’s not store_controller_test.rb (which seems untouched), but rather integration test named dsl_user_stories_test.rb

    2008-09-23
    233OK

    “Let’s run the performance test.” at the bottom of the page - for me it run with error (test takes almost 6 seconds) - probably you’d like to prepare users with older machines for such error

    2008-09-23
    112OK

    At the top of the page you have … “we’ll tart it up in a minute”.

    The would ‘start’ is missing the leading ‘s’.

    2008-09-23
    109TYPO

    I was getting a ActionController::InvalidAuthenticityToken error when I was trying to add items to my cart on page 112.

    I went back to the code on page 109 and added:

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

    It seemed to get it working again.

    Cheers,

    Brett

    2008-09-23
    257TYPO

    Below “David says…” - “blank? method. It always returns false for nil and false, and
    it always returns true for numbers and for true.” - apparently words “false” and “true” should be exchanged.

    2008-09-23
    225OK

    It may be me since I’m new to Rail, which is why I bought the book, but is there a way to debug your tests? That is, to verify that your test is written correctly and the app isn’t working rather than the other way around.

    For example, I kept getting an error running the integration test, UserStoriesTest on the ‘assert_template “index”’ line after the ‘post_via_redirect…’ call, stating that it was working with “checkout” when expecting “index”. It appeared to be a timing issue (the order was saved properly, as verified by the preceding assert statement) and was resolved by moving this call to the end of the test (after verifying the order details). Since my app is stock and the test case was copied from the download file, I would assume that it should complete successfully. However, since it failed, I didn’t know if the test case was bad or whether there was a glitch in the application. Since the application functions just fine interactively, it led me to believe that there was an error in the test case.

    2008-09-23
    300OK

    At bottom of the page you suggest installing low-level C binding to MySql with “gem install mysql” - I tried that and I got an error from gem: “Could not find mysql (> 0) in any repository”. Thus you should update this part or change the command.

    (Sam says: Configuration error? Works for me.)

    2008-09-23
    58OK

    In the Joe Asks… Box there is a line that reads:
    Some folks press the point: “just do these variables get set?”

    with an inserted ‘how’ that only displays ho with a few extra spaces after it.
    Reading it with Preview Version 4.1 (469.2.1)

    (Dave says: I bet it goes away if you reboot. Apple’s PDF viewing has some rough edges)

    2008-09-23
    169OK

    depot_p/app/views/admin/login.html.erb

    Bug: When attempting to log in without correct user-id/password, no errors are displayed.

    Solution: Add line containing flash[:notice], or some better formatted error messages.
    This solution is from a newbie. It would be nice to be nicely formatted like earlier in the book.

    <%= flash[:notice] %>
    <% form_tag do %>

    (Sam says: I see “Invalid user/password combination”)

    2008-12-26
    211OK

    Parts of the chapter “Task T: Testing” doesn’t match the style of the rest of the book. This is especially glaring from the second half of page 211 through the first half of 216. This section reads a lot like The Rails Way.

    That said, there’s nothing strictly wrong with the section. It’s just a look-and-feel nitpick.

    2008-09-23
    192TYPO

    line 7.
    States:
    … five directories and a helper file
    Should state:
    … four directories and a helper file

    2008-09-23
    207OK

    Context “Index: For Admins Only”

    When I checked out the functional tests for my Depot app, I found that some of the controller tests had already been written. You might want to consider how you present this section.

    The inference is that the test has to be written: it’s there already! Whilst not complete I’m sure, I think it would be misleading not to mention that Rails is doing a bunch of stuff to help.

    2008-09-23
    299ERROR

    For example, the following call creates a connection to a SQLite3 database called railsdb on the server dbserver.com using the given user name and password. It will be the default connection used by all model classes.

    ActiveRecord::Base.establish_connection(
    :adapter => “sqlite3”,
    :database => “db/development.sqlite3”
    )

    2008-09-23
    100OK

    The template file in the PDF is correctly named store.html.erb. In the downloadable zip-archive it is named in plural, stores.html.erb. So when you´re simply copy and paste the whole file into your own project, rails doesn´t find, and therefor doesn´t use the template file.

    (Sam says: I can’t find “stores.html.erb” in the downloadable zip)

    2008-09-23
    254SUGGEST

    YYYYAAAAAAAARRRRRRGGGGGGHHHHHHH!!!!!!

    Debugger


    Ok, so it is my fault. I ass-u-me-d it would work.

    In the text above (Step 1 under “To use breakpoints” you say:

    Insert a call to the method debugger at the point in your code where you
    want your application to first stop. You can pass this method a string if
    you’d like—this becomes an identifying message later.

    What tossed me off the rails and into the weeds was the second sentence “You can pass this method a string if you’d like”. Well, I did.

    I inserted “debugger ”Checking why cart is acting strange"

    With that string, the server doesn’t stop. Without that string, the server stops and enters irb. Of even MORE enjoyment is the fact that the community now seems enamored with ruby-debug and I was unable to find any docs on debugger anywhere.

    I suggest you include an example of the “pass this method a string” in the text, or simply leave out that sentence.

    :) Thanks, I feel so much better getting that rant off my chest now.

    - Dave

    2008-09-23
    82OK

    before listing the code listing you say, “don’t worry too much about the details at the moment; we’ll revisit the user interface shortly,” but then the code is not revisited. Specifically, a link to pg. 418 would have been nice to talk about “XXXX_path” and “XXXX_url” being functions (I did a lot of grepping looking for this function :) and also why index.html.erb uses products (with an s) while new.html.erb, etc uses product (no s)… this is because these are passed data with the link_to variable, right?
    Anyhow, I know this is just the introduction but on my fifth reading when I realized I didn’t know what edit_product_path what doing (or why products was different than product) it would have been nice to have a tip.
    Thanks.

    (Sam says: Revisited in A4 on page 90; index lists a number of products (plural), new creates one product (singular))

    2008-09-23
    271OK

    Several concepts of version numbers are introduced: how they are generated, how Rails remembers which migrations have been run, and how to revert a schema to a previous version.

    You’ve gone into several concepts without any examples, and this will confuse first-time readers. Give examples!

    Secondly, when you talk about “how do we revert a schema to a previous version?” the word “version” competes with the term “version number” that we’re talking about, which can confuse readers.

    2008-09-23
    272ERROR

    “creating a model called discount also creates
    a migration called ddd_create_discounts.rb”

    This filename reflects the old migration names. Perhaps the filename should be dddddddddddddd_create_discounts.rb

    2008-09-23
    441TYPO

    Components is mis-spelled in the third bullet point: “compoenents”

    2008-09-23
    312TYPO

    Missing a comma at the end of this line:

    :select => “sku, sum(amount) as amount”

    2008-09-23
    347OK

    What’s left unexplained is a good way to set up your migration(s) for a habtm relationship.

    2008-09-23
    471TYPO

    “We have two controllers, a admin controller….” an?

    2008-09-23
    497TYPO

    In sentence starting with “Other than requiring a…” the word “words” is used when “works” is the correct .

    2008-09-23
    49SUGGEST

    I know it can be silly, but after “Useyourfavoriteeditortochange methods
    the file say_controller.rbintheapp/controllers directory, adding the hello method
    as shown.” it would be useful adding “save the file”.

    2008-09-23
    389OK

    Just before listing at the bottom is phrase that follows: “To do that, we’ll add it [encrypion helper] to the ActiveRecord::Base class.” - I wish you defined where this piece of code should go - I have no idea whether I should put it in basic Active Record directory where it was installed or in app/models in my rails app.

    (Sam says: Download e1/ar/encrypt.rb to see how it could be used)

    2008-09-23
    62TYPO

    Below the “Playtime” heading, second bullet, the first sentence is missing a right paren after “vice versa”:

    Experiment with adding and removing the minus sign at the end of the
    ERb <%= %> sequence (i.e., changing %> into -%>, and vice versa.

    2008-09-23
    396TYPO

    at the bottom you have one listing marked twice by “Download e1/ar/transactions.rb”

    2008-09-23
    399TYPO

    as before - dupliacate “Download e1/ar/transactions.rb”, but here we see no difference between code and it’s output (output looks as if it was a part of the code) - there should be at least a word of introduction as it appeared before

    2008-09-23
    414OK

    the first listing on this page:
    >> rs.generate({:action => “edit” , :id => 123}, last_request)
    => “/blog/blog/edit/123”.
    I suggest stressing that blog controller (which at first appeared out of thin air to me) comes from ‘last_request’ param (in which it is default, and therefore hidden)

    2008-09-23
    424TYPO

    just after the output: “Have a look at the last line of the output of this command.”, but later you refer to routes which comes at the middle of the output.

    2008-09-23
    434OK

    in restful2/app/controllers/comments_controller.rb listed in this page in action create (and update also) we don’t save the parent after doing << operation (or update_attributes in update)

    2008-09-23
    allOK

    just an FYI, reading the PDF at 100% magnification in Adobe Acrobat on a Mac, the equals sign is indistinguishable from a dash.

    2008-09-23
    54TYPO

    The word ‘whitespace’ is improperly hyphenated and broken across lines 4-5 as ‘whites-pace’.

    2008-12-31
    54TYPO

    In footnote #9, the word ‘and’ at the beginning of line 2 should be ‘at’: “9. If you still see blank lines in the output check to make sure that there aren’t any blank spaces
    and the end of the lines.”

    2008-09-23
    445TYPO

    according to the description of render(:file…) method in the middle of the page, I should look for help according changing default template base path at page 245, but either it’s not yet described there or I should look for this help somewhere else (probably in page 443 where you show how to use ActionController::Base.template_root=dir_path or in one of appendices)

    2008-09-23
    125SUGGEST

    The second paragraph starts with “In the old days (up until a year or two ago), browsers were treated as really dumb devices.” This is exactly the same sentence used in the second edition. Surely, the tongue-in-cheek comment in the parentheses is no longer necessary.

    2008-09-23
    640OK

    Another common error is having only install mongrel not mongrel_cluster. Doing:

    sudo gem install mongrel_cluster

    fixes the “ERROR RUNNING ‘cluster::configure’: Plugin /cluster::configure does not exist in category /commands” error.

    2008-09-23
    122ERROR

    This may be a suggestion, who knows. During the example of adding the total price to the Depot cart the example image shows a formatted Total cell along with a formatted individual item price cell. The used css tags are item-price and total-cell neither of which are defined in the depot.css currently available. Copy & Pasted from the URL provided in the eBook on September 23, 2008. In all other cases where new CSS was introduced a code block was included with the additional css but it appears to be missing in this example.

    Hope I didn’t miss something.

    2008-12-26
    658TYPO

    4th paragraph, last sentence: has_may s/b has_many

    2008-12-26
    612TYPO

    last bullet point: while I’m flattered that you would name a whole format after me, I think JON is supposed to be JSON

    2008-12-26
    642ERROR

    2nd to last paragraph, the command to clear database sessions is truncated (appropriately enough, with …TRUNC). If this was intentional, then this is a suggestion to include the rest of the command.

    2009-01-02
    645TYPO

    Rails 2.2 Warning box, 2nd to last sentence: onlin s/b online

    I recognize that this may be moot if the warning box is not included in the released edition, but though it should be mentioned just in case…

    2008-12-26
    655TYPO

    “This gives the translators the opportunity to provice the
    correct pluralization of nouns and to match the verbs with the nouns.” provice s/b provide

    2008-12-26
    658SUGGEST

    6th paragraph, last sentence: “once we are completed” s/b “once we are finished” or “once we finish”

    2008-12-26
    688SUGGEST

    also pages 697, 699, listings are truncated with …TRUNC, should probably be line-wrapped instead

    2009-01-02
    658TYPO

    hay_may should be has_many

    2008-12-26
    140SUGGEST

    The last sentence, in which you state that “making our application work regardless of whether JavaScript is enabled takes just a two line of code change in the add_to_cart action,” is awkward. Perhaps the following would be better: “. . . enabled requires just two lines of code in the add_to_cart action.”

    2008-12-26
    147ERROR

    Hi, You have the following code snippets at the top of this page.
    <%= button_to “Checkout” , :action => :checkout %>
    <%= button_to “Empty cart” , :action => :empty_cart %>

    The second is the line of code to be added but the first reflects the code before the ajax changes have been applied and actually looks like this

    <% form_remote_tag :url => { :action => :empty_cart } do %>
    <%= submit_tag “Empty cart” %>

    This raises questions over which format should be used at this point for the check out button.

    Hope this helps.

    (Same says: depot_p/app/views/store/_cart.html.erb shows button_to has been used consistently)

    James

    2008-12-26
    147TYPO

    “Maybe we want to edit an existing model”

    Should that read

    “Maybe we want to edit an existing order”

    2008-12-26
    604TYPO

    byes should be bytes

    2008-12-26
    607TYPO

    “…login form, the will see” => “…login form, they will see”

    2008-12-26
    603SUGGEST

    Maybe it’s late, but… Perhaps add a definition for ActiveResource in the opening paragraph of the chapter?

    2008-12-26
    206TYPO

    Agile Web Development with Rails 3nd Edition (Beta 1.3 - 20080604).pdf

    Building an Application - Task F: Administration - Iteration F2: Logging In - Page 168
    ———————————————————————————————————————————
    Create controller “admin”, actions “login”, “logout” and “index”, by command

    \truby script/generate controller admin login logout index

    However,

    Building an Application - Task T: Testing - Functional Testing of Controllers - Login - Page 206
    ————————————————————————————————————————————————
    “Because the LoginController was created with the generate controller script, Rails
    has a test stub waiting for us in the test/functional directory.” (Download depot_r/test/functional/login_controller_test.rb)

    I think,
    the Controller should be AdminController rather than LoginController,
    and the functional test file should be “admin_controller_test.rb” rather than
    “login_controller_test.rb”

    2008-12-26
    50OK

    The demo example doesn`t work, since there is no database table!
    Okay, i did not exactly follow the guide… i am using Aptana… but this mistake should occure anyway.

    greeting, Chris

    (Sam says: Works from the command line, and sqlite3 databases are created as needed.)

    2008-12-26
    250OK

    In section 14.4
    “They’re surprised that they call a model class Person and
    Rails somehow knows to go looking for a database table called people”

    people table? or person table?

    2008-12-26
    605TYPO

    Missing word: “with”
    It generally is more popular WITH a number of scripting languages (a notable exception being JavaScript) than with statically typed languages, …

    2008-12-26
    603SUGGEST

    At the beginning of this chapter (Active Resources), before the presentation of alternatives to the chapter’s subject, I would really appreciate at least one short paragraph that outlines what it (the chapter’s subject) actually is.

    2008-12-26
    147SUGGEST

    “As it stands, that’s not particularly interesting: because it’s a new model, all the fields will be empty. However, consider the general case. Maybe we want to edit an existing model.”

    I think you’re using the word “model” where the word “order” (an instance of the order model) would be more clear. (Similarly, in the next sentence you say “tried to enter an order”, and I think that’s right.) Suggest:

    “As it stands, that’s not particularly interesting: because it’s a new order, all the fields in the model will be empty. However, consider the general case. Maybe we want to edit an existing order.”

    2008-12-26
    194TYPO

    I think the list of files from “ls test/functional” may be out of date? In my depot directory at this point, I also have line_items_controller_test.rb and orders_controller_test.rb

    2008-12-26
    223OK

    At the end of the section on unit tests, “rake test:units” runs cleanly, and the same with the section on integration tests. But at the end of this section on functional tests, “rake test:functionals” has lots of failures. (This is true even if you try it directly on the unmodified “depot_r” directory distributed on the Prag. Prog. web site.)

    2008-12-30
    275TYPO

    “If we were to run migrations again at this point, nothing much would happen.
    Each of the version numbers of the migration files would match with a row the
    database, so there’d be no migrations to apply.” Shouldn’t this be “with a row IN the database”?

    2008-12-26
    188TYPO

    Then we provide a template, which makes use not only of the generic XML
    functionality that builder proviles,

    2008-12-26
    679TYPO

    There are index entries that say see Component, but there is no index entry for Component.

    2009-01-02
    313OK

    I found the order by example a little confusing, simply because it was in the context of product orders. Here’s the code:
    orders = Order.find(:all,
    :conditions => “name = ‘Dave’” ,
    :order => “pay_type, shipped_at DESC” )

    There are four different uses of the word “order”, and it took me a moment to think it through. This might mean it’s a good example because it forces the reader to think, but I thought I’d point it out just in case it wasn’t intentional.

    2008-12-26
    240TYPO

    “rake db:schema_migrations” instead of “rake db:schema_version”,
    since “task :schema_migrations”

    2008-12-26
    612TYPO

    “This behave the same as validation does
    in ActiveRecord.” behaveS

    2008-12-26
    337TYPO

    If you used some other name,
    you’ll need to add a :foreign_key declaration so Rails Rails can find it.

    2008-12-26
    343TYPO

    The :dependent option tells Active Record what to do with child rows when you
    destroy a row in the parent table. It has five possible values.

    Five or three?

    2008-12-26
    54TYPO

    On the Second paragraph on the first line there is the sentence: “Normally, this doesn’t matter, because HTML…”

    The end of the line is ends up with “white-” and the next line have “pace.”, it should be “white-space” and not “white-pace”.

    2008-12-31
    43ERROR

    Reference/link “Postgres hxxp://ruby.scripting.ca/postgres/” is incorrect. Link is broken (yields 404 page; looks like domain wasn’t renewed and got picked up by domain squatter.)

    From what I’ve been able to gather, the (most) official source for a Ruby-based interface to PostgreSQL specifically (as opposed to Ruby/DBI) is via the Ruby-PG project:
    hxxp://rubyforge.org/projects/ruby-pg

    [Had to munge the protocol since the errata form doesn’t allow URL posting in errata reports.]

    2008-12-26
    501ERROR

    Hasn’t Rails 2.1 been RESTful for awhile? I don’t understand “…as Rails moves in a RESTful direction” with a footnote to 7:
    7. As this book is being finalized, a plugin called Simply Helpful is being worked on. This plugin
    makes it even easier to integrate models, REST, and form_for. The plugin might end up in core Rails.

    2008-12-26
    101ERROR

    The styles shown in that page are not for the task 7.2 (Add a Page layout). I believe it’s for the Cart layout.

    2008-12-26
    101TYPO

    The stylesheet modifications at the end of section 7.2 don’t have anything to do with the output of the main “store” page. All the needed styles are already in the previously referenced stylesheet.

    2008-12-26
    102SUGGEST

    Minor point: The styling of the page is such that the price of the last entry in the catalog (Pragmatic Version Control) doesn’t clear the picture when the page is very wide (I am using 1680x1050). Adding a ‘br clear=“left”’ tag fixes this, but adds unneeded space…

    2008-12-26
    116OK

    “show her the result of our morning’s work.” - according to the story you are spinning, it is after lunch and you have made these changes in the afternoon. Perhaps “day’s work”?

    2008-12-26
    113OK

    Some explanation of this syntax would be helpful:

    current_item = @items.find {|item| item.product == product}

    2008-12-26
    111SUGGEST

    Since later in the book (p118) you are swapping the order the calls to find_cart and Product.find (lines 2 and 3 of store_controller.rb), it is a little clearer to swap their order here, so that it is clearer on p118 what changes

    2008-12-26
    122OK

    The method name of “redirect_to_index” is perhaps a little misleading; it doesn’t take into account the flash. Perhaps call is “flash_and_redirect_to_index”. A little long, I admit.

    2008-12-26
    123TYPO

    Inconsistent use of parentheses:

    <%= h(cart_item.title) %>

    2008-12-26
    142TYPO

    Line 7 - “Others finds it useful” should be “Others find it useful”

    2008-12-26
    198TYPO

    the 2nd line of the 2nd loop for the test_image_url method is truncated. It’s easy to figure out but I wonder why the previous loop had each parameter of the Product.new() call on a new line but the second loop does not. Previous pages / examples make no elusion to the idea that space is a concern in this book and I find it strange that it appears to be now.

    —Matt Stuart

    2008-12-26
    98OK

    Typesetting software is producing ligatures in the text - it’s fine for the most part, but when I copy+pasted “find_products_for_sale” in the second line, the initial fi ligature caused some “issues” with the Ruby interpreter until I took a closer look at the code…relatively easy to spot if you’re using a monospaced font (doesn’t everyone?)

    It’s not a huge deal, but perhaps something that might be looked at?

    (Dave says: we provide all the source from the examples as downloads (normally by simply clicking in the PDF).)

    2008-12-30
    36OK

    Doesn’t this command work for all operating systems, not just Mac OS X?
    When would this step be necessary?
    Couldn’t one just do
    rake db:migrate
    to see if the database is configured?

    The book states:
    The following step is rarely necessary, but can be helpful if things continue to
    go wrong. You can verify which version of sqlite3 your sqlite3-ruby inter face
    is bound to by running the following either as a standalone program, or from
    within irb, or from within ruby script/console.
    require ‘rubygems’
    require ‘sqlite3’
    tempname = “test.sqlite#{3+rand}”
    db = SQLite3::Database.new(tempname)
    puts db.execute(‘select sqlite_version()’)
    db.close
    File.unlink(tempname)

    2008-12-26
    36SUGGEST

    Instead of saying 10.4 and 10.5, and then latter referring to Tiger and Leopard, but not telling the reader that 10.4 is Tiger, and 10.5 is Leopard,

    why not say 10.4.x and 10.5.x and for versions greater than 10.5.x look on your website for instructions?

    That way, 3 mac releases from now, people won’t be pondering what version was Tiger and what version was Leopard.

    Also do these instructions imply equally well for the client version as well as the server version of 10.4.x and 10.5.x?

    2008-12-26
    38OK

    Was:
    How to change the version of Rails that your
    application is using is described in the sidebar on page 246.

    To: How to change the version of Rails that your application is using is described on pages 245 to 247.

    Comment:
    freeze is mentioned on pages 41, 245, 246, and 247

    2008-12-26
    38OK

    Since there are multiple authors, does it make sense to say

    I write my Rails programs using a programmer’s editor

    wiihout identifying who I is?

    Perhaps one could say that Mac OS X users prefer TextMate, Xcode, Netbeans, vi, vim, and emacs.

    Linux users use:

    Window users use:

    What does James Duncan Davidson use and why?

    2009-01-07
    41SUGGEST

    To view the Rails API documentation, open the location

    doc/api/index.html ( or rails_apps/demmy_app/doc/api/index.html)

    with a browser.

    2008-12-26
    163OK

    I had omitted the “require ‘digest/sha1’” from my User model and got all the way up to successfully login in before I noticed. Does it really need to be there?

    2008-12-26
    111OK

    Possible error (I’m just learning)—my cart would not update and it would only add one item. I’d return to the store, add another and only the newly added item would be there. The session was not updated. This was corrected with the line

    session[:cart] = @cart

    added before the end of the add_to_cart method. (I am using mySQL instead of SQLite3, so maybe in SQLite this updates automatically? Where is the session actually set to our cart? The other way happens in the find_cart method called in add_to_cart, but don’t we need to update the session’s cart?)

    2008-12-26
    179OK

    Re: “We created a virtual attribute representing the plain-text password and coded it to create the hashed version whenever the plain-text version is updated”

    The word “updated” is incorrect - we never addressed the ‘edit’ action upon users, so it is currently impossible to “update” a user. The sentence needs to be re-written to be more correct.

    (Sam says: The model does exactly this; updating the view is a playtime activity)

    2008-12-26
    179OK

    Re second bullet point about GET/POST differences. I’m sorry, I went over it twice and can’t see a thing relating to this. We updated the ‘update’ action to redirect to the index, but other than that…

    (Sam says: iteration F2, method login)

    2008-12-26
    78OK

    Page 69 states
    A few “magic” commands worth knowing, explained in detail later: rake
    db:sessions:clear and rake db:migrate VERSION=0.
    Page 77 states
    And that’s it. Rake looks for all the migrations not yet applied to the database

    Page 78 states
    and applies them. In our case, the products table is added to the database
    defined by the development: section of the database.yml file.7

    7. If you’re feeling frisky, you can experiment with rolling back the migration. Just type
    depot>rake db:migrate VERSION=0

    Shouldn’t there be a caveat here about the order of the timestamps does matter, if one
    does a db:migrate VERSION=0
    followed by a
    db:migrate

    if I use

    1) my own 20090601000002 AddPriceToProduct: which says 2009 rather than 2008
    (the db:migrate will work as you have stated)

    2) Your book file db/migrate/20080601000003_add_test_data.rb
    (the db:migrate will work as you have stated)

    However,
    when I then do a
    db:migrate VERSION=0
    followed by a db:migrate
    then
    add_test_data will be run before addPriceToProduct,
    so add_test_data will fail because the price column isn’t there.

    (Sam says: Migrations is covered in chapter 16; at this early stage what is being described is only enough to get you started)

    2008-12-26
    145TYPO

    The link to Tobias Lütke’s ActiveMerchant library is not correct. This seems to be better: www.activemerchant.org

    2008-12-26
    145OK

    Payment module∗seems to be dead -> discussion seemst to indicate that people should use ActiveMerchant instead. Suggest to kill reference here.

    2008-12-26
    161SUGGEST

    In the explanation of why we use ‘self.salt = ….’ it says: “… Without the self., Ruby would
    have thought we were assigning to a local variable, and our code would have no effect. ”
    That is pretty clear, what is NOT so clear is, why is the writer not using ‘@salt = …’? After looking at the example several times I am still not sure whether those two are equivalant in this case.

    2008-12-26
    69TYPO

    “Typos happen to the best of us and side explorations
    are not only are possible, they are positively encouraged.” Should read “side explorations are not only possible, ”?

    2008-12-26
    174ERROR

    at the beginning of 11.4 we add layout “store” and are told to visit ‘admin’, and only later the text mentions the need to remove references to cart.
    That should be done before attempting to visit the said urls

    2008-12-26
    122SUGGEST

    in “<% for cart_item in cart.items %>" cart_item is different from the previously used "<% for item in cart.items %>”
    It would avoid confusion to continue to use the previous “item” version instead of “cart_item”. It is also more logic.

    2008-12-26
    186TYPO

    we never added product id 1, the example should use 2 (or 3 or 4)

    2008-12-26
    673ERROR

    hxxp://www.rubyveil.com/ is no longer valid (domain not renewed by original registrant)

    hxxp://www.rubygarden.org/ - “RubyGarden is offline temporarily due to excessive spam.” - listing a ‘resource’ that’s offline due to a spam DoS is questionable.

    2008-12-26
    123OK

    The total price should be calculated like this:

    def total_price
    @items.sum { |item| item.price * item.quantity}
    end

    (Sam says: CartItem.price is defined to be product.price * quantity)

    2008-12-26
    136OK

    Having completed Iteration D3 everything works fine as long as there are already products in the cart. But if I empty the cart and add a book to the cart, I get the following error:

    RJS error: TypeError: $(“current_item”) is null

    I next get a longer error message:

    Element.update(“cart”, "

    Your Cart

    \

    \
    \

    \
    \

    \

    \

    \

    \
    \
    <tr class \\“total-line\\”>\

    \

    \

    \
    \

    1&times;

    Pragmatic Project Automation

    $29.95

    Total

    $29.95

    \
    \

    <input type=\\“submit\\” value=\\“Empty cart\\” />

    “);
    $(”current_item“).visualEffect(”highlight“, {”endcolor“: ”#114411“, ”startcolor“: ”#88ff88"});

    The cart then updates, but without highlighting the change. If I add another copy of the same item, everything work as expected again.

    2008-12-26
    562ERROR

    “script/plugin install git://github.com/rails/auto_complete.git”

    The above assumes that git is installed on your machine.
    If git is not installed, then one needs to install it.

    2008-12-26
    18OK

    .. such as AJAX and RESTful
    inter faces into their code: support is built in. (And if you’re not familar with
    AJAX and REST inter faces, never fear —we’ll explain them later on.)

    AJAX is not defined until page 125.
    Restful is never defined. A little googling showed that Sam Ruby has written “Restful Web Services” and DHH wrote the forward for the book, so perhaps you know too much about Restful.

    All I was looking for is a simple definition of Restful which I found at wikipedia (so maybe it isn’t even right)

    http en.wikipedia.org /wiki/ Representational_State_Transfer
    Systems which follow Fielding’s REST principles are often referred to as “RESTful”.

    (Sam says: REST is described in section 20.3)

    2008-12-26
    142OK

    hxxp://pragprog.wikidot.com/rails-play-time - doesn’t contain reference/discussion for first bullet point in “Playtime” for Task D.

    [Yes I know it’s a wiki and I could get an account…meh.]

    2008-12-26
    646TYPO

    The letter “e” is missing from the word “online” in the phrase: “but they are onlin and can be downloaded” (which is located closer to the bottom “Rails 2.2 Warning” section).

    2008-12-26
    152OK

    In footnote 5, the text “because an application can’t assume” should be “because an application shouldn’t assume”.

    We all know of applications that do assume, so “can’t” isn’t correct: “shouldn’t” is more appropriate.

    2008-12-26
    153OK

    Directing readers to follow (“On line 3…”, “on line 5…”) a code snippet that is interrupted by 2 footnotes, a page break and a “Joe Asks…”? Probably not the smartest layout…

    [If it wasn’t obvious, my suggestion is to arrange the text such that the code isn’t broken up at all.]

    (Dave says: we fix this kind of problem during layout)

    2008-12-30
    33OK

    I think you really should mention heroku.com as a way to develop an application without having to install everything. It’s invaluable for learning and playing around without committing the time to getting a development environment set up.

    Thanks for the awesome work!
    Victor

    2008-12-26
    109ERROR

    In application.rb we are told to add the following:

    session :session_key => ‘_depot_session_id’

    however in the environment.rb file created the session_key is ‘_depot_session’ — these two have to match so one or the other needs to be changed.

    2008-12-26
    607TYPO

    In the paragraph after the word “Success!”, third sentence, you have, “… as once you get provide the …”. Remove the word “get”.

    2008-12-26
    610TYPO

    In the last paragraph, fourth sentence, you have, “Parameters that match the site template provided in for …”. Remove the word “in”.

    2008-12-26
    80OK

    Code example typo:

    ….add when it adds columns to an existing table.

    depot> ruby script/generate migration add_price_to_product price:decimal
    exists db/migrate
    create db/migrate/20080601000002_add_price_to_product.rb

    Notice how the generated file has a UTC based timestamp…

    First line of code has a space missing between the migration name and symbol. Should read:

    depot> ruby script/generate migration add_price_to_product price :decimal

    Sam says: It is not a symbol, it is a separator)

    2008-12-26
    174SUGGEST

    Why don’t you remove app/views/layouts/order.html.erb like as product.html.erb and user.html.erb file?

    You generated order by call scaffold, it made app/views/layouts/order.html.erb file automatically. When the layout file exist, he nice global layout isn’t applied to screen even I click order link on side panel.

    I use rails 2.1.1 in Ubuntu 8.10.

    thanks.

    2008-12-26
    603SUGGEST

    I agree with the other two comments regarding this page. The first paragraph in “Alternatives to ActiveResource” launches into a discussion of “different approaches to solving this problem” without ever defining what this problem is. What problem does ActiveResource solve? What is ActiveResource? Many people reading this chapter will have no idea what ActiveResource is, as it is not mentioned anywhere previously in the text.

    2008-12-26
    711+ERROR

    The Index contains a circular reference—the entry for REST says “see also Web service”; the entry for Web service says (in it’s entirety) “see also REST”.

    2009-01-02
    52OK

    Say hello demo does not work. There is no route to the resource hello as it is not one of the standard REST actions.

    I get the following error:

    Routing Error

    No route matches “/say/hello” with {:method=>:get}

    I have resolved this by adding the following line to routes.rb:

    map.resources :say, :collection => { :hello => :get }

    Regards. Vicente Bosch

    2008-12-26
    30SUGGEST

    I would expect much more Hyperlinks in a book which is deliviered electronically (PDF).

    (Dave says: all cross references within the PDF, and (in theory) all external URLs are hyperlinked. Could you e-mail me (dave@pragprog.com) with additional links you feel we should have?)

    2008-10-22
    77SUGGEST

    in the command at the top of the page, the ‘>’ for the second line confuses windows folks; I included the ‘>’ in the command and the scaffold worked, just skipped creating the title attribute. Any chance that second prompt could look like ‘depot>’; would be clear what is going on.

    2008-12-31
    80TYPO

    Chapter 6, Footnote 10: “preceeding” should be “preceding”.

    2008-12-26
    486TYPO

    Page 486 says “A Builder template (in a file with an .xml.builder extension)…” but then the example (“Here’s a simple Builder template…”) filename is erb/builder.rb. Should this not be erb/builder.xml.builder?

    2008-12-26
    183TYPO

    The generate script also produces a view file:
    create app/views/info/who_bought.html.erb
    [Running under Rails 2.1.1 - not sure when/if this changed or if it was just an omission from the text.]

    2008-12-26
    633SUGGEST

    “If you have an existing complex web site, chances are that you’re running Apache to weave
    all the parts together.”

    Chances are also pretty good that if:
    a) you’re running Apache, and
    a) you’re experienced with Apache, but
    b) new to Rails
    you’ll probably get on the bandwagon of mod_rails, along with everyone else that had their heads done in by deploying under Mongrel et al.

    At least a mention of it wouldn’t go astray…it’d certainly be more than what can be found in “Deploying Rails Applications” [singularly useless book - my only regretted PragProg purchase]

    2008-12-30
    266SUGGEST

    My ruby version is 1.8.7 (pathlevel 72) and it already has Symbol#to_proc!!. Of course, rails 2.1.1’s Symbol class still redefine to_proc method, but it can raise confusing to reader if there isn’t any mention about it. :-)

    2008-12-26
    94ERROR

    Text states that “we created a depot.css stylesheet” but all that was done on previous pages was to add a reference to the depot stylesheet on the products layout page. There is nothing to show the actual creation of the depot.css stylesheet.

    2008-12-26
    116OK

    Text states “exception at line 16”; however, a close look at your figure 8.2 on the next page indicates it is line 10.

    (Sam says; See footnote)

    2008-12-26
    allOK

    A common requirement that clients have is the ability to create URLs with hyphens rather than underscores (i.e., good looking and SEO optimized URLs). It would be nice if the Rails book included some insight on how best to achieve this. Permalink-Fu is one option. Is it the best option? Is it the only option?

    2008-12-26
    68OK

    The paragraph is as follows:

    you can now skip forward to (((Section 6.1, Create the Products Database and Maintenance Application))), on page 73.

    There is NO section with this title, as the mentioned title is PART of section “6.1”.

    Thanks.

    (Sam says: the paragraph is on page 71, refers to section 6.2 on page 75, which is a section. I checked all prior public betas, and none of them had this problem.)

    2008-12-26
    437TYPO

    “To deal with this, Rails 1.2 allows you
    to pass the format of response you’d like as part of the URL.”

    Odd that this statement is limiting itself to Rails 1.2 specifically.
    Should that read “Rails 1.2+”? Or perhaps “since Rails 1.2 you can pass”?

    2008-12-26
    161OK

    Pretty minor but “and then run an SHA1 digest on the result” should be “and then run a SHA1 digest on the result”.

    The former would be OK if people spelled the letters ‘S’ ‘H’ ‘A’ individually when encountering SHA1, but it is typically said as ‘shaw one’ which would make “a” more appropriate.

    2008-12-26
    363OK

    I think you mean:

    depot> sqlite3 -line db/development.sqlite3 “select * from catalog_entries”
    id = 2
    name = Article One
    acquired_at = 2008-05-14 12:03:24
    resource_id = 2
    resource_type = Article

    should be:

    depot> sqlite3 -line db/development.sqlite3 “select * from catalog_entries”
    id = 2
    name = Article One
    acquired_at = 2008-05-14 12:03:24
    resource_id = 1
    resource_type = Article

    2008-12-26
    517OK

    While Defining helpers in TaggedBuilder, it’s not enough to iterate over filed_helpers. As of Rails 2.1.1, field_helps only have “label check_box radio_button fields_for”. So text_field, text_area funtions are required for expected behaviou.

    Regards,
    Asang..

    (Sam says: With Rails 2.2.2, I get [“check_box”, “radio_button”, “password_field”, “label”, “text_area”, “apply_form_for_options!”, “hidden_field”, “fields_for”, “text_field”, “file_field”])

    2008-12-30
    343TYPO

    For :dependent => . . . “It has five possible values.”

    Then you list some ways to set :dependent. But it doesn’t add up to five. According to what you’ve written, it would seem to be:
    :dependent => :destroy
    :dependent => :delete
    :dependent => true (given as an alternative for both of the above)
    :dependent => :nullify

    It makes no sense.

    2008-12-26
    188TYPO

    functionality that builder proviles, but also

    should read

    functionality that builder provides, but also

    2008-12-26
    210TYPO

    “We have to remember to add the fixtures directive to the login controller test class. ”

    would be better stated as

    "We have to remember to add the fixtures directive to the admin controller test class.

    2008-12-26
    31TYPO

    Last paragraph on the page:

    “The most common templating scheme, called ERb embeds snippets …”

    should be

    “The most common templating scheme, called ERb, embeds snippets …”

    2008-12-26
    38TYPO

    In the penultimate paragraph, in the sentence, “It’s a simple way to ensure that accidential breakages get immediate attention.”

    “accidential” should be “accidental”

    2008-12-26
    41ERROR

    Footnote 5 makes no sense. It says the same thing as the footnoted sentence. Both say to use the command “gem server”. Either this command should be different for one version, or the footnote is unnecessary

    2008-12-26
    429TYPO

    In the code listing, the code for the ‘Destroy’ link is wider than the page, and instead of
    “:method => :delete”, you have “:method => :de…TRUNC

    2009-01-02
    180TYPO

    When I issued the command “prd = Product.new” at the script/console the output I saw was:

    #<Product id: nil, title: nil, description: nil, image_url: nil, created_at: nil, updated_at: nil, price: nil>

    Is this to be expected?

    2008-12-26
    ALLOK

    It would be great to see a section on the symbols used in rails with a description of what each is used for rather than an example.
    e.g.
    => This symbol assigns …
    | Still don’t know what this does

    1. Is this a way of converting a variable to a string?
      {}
      ()
      <
      GSub with all those /\\ things after it. I really haven’t got a clue what this is or how it works. Can’t find any info on this anywhere.

    etc…

    I have a number of times struggled to understand the syntax used whilst developing the Depot app (And still am in some cases) and when I have had to go and look up what a # is doing in the middle of a string for example I have struggled to find a reference that explains what it is and how it works.

    I suppose a quick reference guide is what I’m looking for.

    Thanks

    James

    2008-12-26
    210OK

    “an SHA1 hash value” should be “a SHA1 hash value”.

    2008-12-26
    167OK

    My users/new page works, but does not look like the screenshot. Was the depot.css updated?

    Also, changing app/views/users/edit.html.erb was not discussed. It still has the Hashed password and Salt fields from the scaffold.

    2008-12-26
    247SUGGEST

    The Trac Timeline is no longer being used. This page should be updated to reflect Github/Lighthouse

    2008-12-26
    262TYPO

    Inflector should be ActiveSupport::Inflector

    2008-12-26
    354TYPO

    Grammatical error, rather than a typo — second paragraph: “have the code … add their own conditions”. ‘code’ is singular, doesn’t agree with plural ‘their’. This should either be “have the code … add its own conditions”, or soemthing like “have the pieces of code … their own” or “have the code segments … ” or some other rewording to turn ‘code’ into a plural phrase.

    2008-12-26
    256TYPO

    The phrase “you’ll be in an ruby-debug session” should be “you’ll be in a ruby-debug session”.

    2008-12-26
    167ERROR

    There is a problem with the style sheet and the error flash.

    If no user name is entered and the form is submitted the layout jumps all over the place trying to display the red borders and highlights.

    Name: Field

    Becomes

    Name
    :
    Field

    I can only assume that this is a CSS error

    2008-12-26
    652TYPO

    The I18n config file values for the currency formatting don’t appear to be in the pdf

    2008-12-26
    278OK

    In Figure16.1:Migration and Database Column Types

    db2 x :text should read:

    blob(32768)

    likewise oracle x :text should read

    blob

    (not clob)

    Also, on postgresql x :binary, is “bytea” a valid column type (I don’t know Postgresql).

    2008-12-26
    291TYPO

    The phrase “you’ll have to weight the risks” should be “you’ll have to weigh the risks”

    2008-12-26
    357TYPO

    In the last row of the People table, Dino Dogg’s email address has a TLD of “.prg” rather than “.org”, i suppose.

    2008-12-31
    293TYPO

    Based on the instructions in the demo section, “unit_price” should be “total_price”.

    2008-12-26
    648ERROR

    It seems that load_translations was substituted for load_path in October. I don’t get these examples to work using rails edge downloaded as of November 6 2008. More info in this google group: group/rails-i18n/browse_thread/thread/103b9c555b6fb54e

    2008-12-26
    392TYPO

    “… on page 387 we created a callback that generated a log message …”
    The referenced callback is actually on page 388 in this version.

    2009-10-17
    395TYPO

    find_by_sql call with “as” clause is too wide for the page, and gets truncated, with “TRUNC”. Should be split up with string addition, as in previous example at top of page, e.g.
    LineItem.find_by_sql(“select id, quantity, ” +
    “quantity*unit_price as total_price” +
    " from line_items");
    result =

    2009-01-02
    104SUGGEST

    We’re working away at putting a button on the page, then instructed to put an action in that won’t work - “So, that’s what we will have to fix next.” Then the chapter ends!! We’ve been told that the page won’t work and then given exercises! How much better to exclude the action & product id, viz <%= button_to “Add to Cart” %> & amend the text that followed to:
    “Now our index page looks like Figure 7.3. Of course, if you push the button now nothing will happen because the button has no action associated with it. So, that’s what we will have to fix next.”
    The caption to figure 7.3 will be accurate as well!! The action can be entered in the following chapter.
    Well it seems logical to me!

    2008-12-26
    593TYPO

    The experiment using TestController does not work with the example recipients given (recipients [ “andy@pragprog.com”, “Dave Thomas <dave@pragprog.com>” ] ), because the browser interprets the angle brackets as HTML markup, and removes the contents of the angle brackets. You should point that out in the text, and suggest using View Source to see the actual email. Thanks!

    (Sam says: changed to use ‘h’ helper)

    2008-12-30
    363OK

    depot> sqlite3 -line db/development.sqlite3 “select * from catalog_entries”
    id = 2
    name = Article One
    acquired_at = 2008-05-14 12:03:24
    resource_id = 2
    resource_type = Article

    resource_id should equal 1, unless you have data left over from the last example.

    2008-12-26
    499TYPO

    “The proxy returns to the first 10 users” should be “The proxy returns the first 10 users” (no “to”). (But see separate erratum report, 10 should really be 30)

    2008-12-26
    502OK

    Section 22.5, paragraph 2, “The first parameter does double duty: it tells Rails the name of the object being
    manipulated (:user in this case)”

    and even though this terminology (“name of the object”) matches what’s in the Rails API documentation, I think it would be clearer to say that it tells Rails the CLASS of the object being manipulated.

    2008-12-30
    511TYPO

    “keep it in an ancilliary details table”: “ancilliary” should be “ancillary”

    2008-12-26
    518TYPO

    First code sample on page is too wide, *TRUNC*ated.

    2009-01-02
    517ERROR

    The source code provided from the link Download e1/views/app/helpers/tagged_builder.rb does not match the code example in the pdf.

    2008-12-31
    107OK

    the user will get very confused as items appear
    and disappear in their cart across requests. (I think it should be “users”; the plural, because it is also “their” cart; or have I msunderstood something); best regards

    2008-12-26
    123OK

    There is no error in total_price, but rather in our (the user’s) code for CartItem.price; CartItem.price should return the cost of the item times the quantity. (See page 113.)

    2008-12-26
    97SUGGEST

    After creating the storecontroller you might want to mention for them to restart webrick so the updates for the new route get picked up.

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    88OK

    in the code for price_must_be_at_least_a_cent where it says price < 0.01 - it needs to be price.to_f < 0.01 because of error with comparing string to float. This was with rails 2.1.2

    (Sam says: Price is decimal, not string)

    2008-12-26
    69TYPO

    In the General Recovery Advice box the sentence ‘then everything should work described.’ would read better as ‘then everything should work as described.’

    2008-12-26
    258SUGGEST

    In the demo that starts off section 15.1, you might want to add

    require ‘activesupport’

    to the top of code block so that this could be run using the irb shell. This is a given for some users, but may not be for rails beginners. Thanks.

    2008-12-26
    151SUGGEST

    The CSS breaks a bit here. Only inputs get the margin, and selects and text areas aren’t inputs (for styling anyway). It should rightly be:

    .depot-form input, .depot-form select, .depot-form textarea {
    margin-left: 0.5em;
    }

    2008-12-26
    157SUGGEST

    the code for add_to_cart.js.rjs is missing the > to show that only the first line needs to be added to the code

    2008-12-26
    256TYPO

    “You can list source, exhamine your stack frames,” should be “You can list source, examine your stack frames,”

    2008-12-26
    89TYPO

    The footnote on the bottom of page 89 is a carry over from page 88 and starting is mid thought which is confusing to the reader.

    (Dave says: we fix this kind of thing during layout)

    2008-12-30
    52OK

    In your whirlwind intro to ERb, the one thing that is missing is the comment syntax, <#> . Any programmer is going to want to add comments, but I (eventually) ran into a somewhat difficult to track down problem using what seemed the obvious solution to me: just putting a Ruby comment within <% %> (I think I was crashing the Ruby interpreter, but instead of getting an error message, the output just disappeared). Anyway, my suggestion is to mention that you can add comments with <#> and that <% # %> is considered an ERb syntax error.

    2008-12-26
    563TYPO

    on line 5 of the code at the bottom of the page, there is a dangling ‘#’ character; it is not clear what that is for. In my testing, breaking a ruby line in ERb does not seem to cause a problem, even without a ‘#’. As mentioned in a previous submission, I have had problems with ‘#’ within ERb. In any case, a reason for the ‘#’ should probably be given, if it is intended.

    2009-01-02
    623TYPO

    In the last paragraph of section 26.6, where you suggest creating a new session, you might say HOW to create the new session, with reset_session . It might also be a good idea to mention that (and include the code for it) in the code in section 11.2, where you give the code for the login function, as well as the “a friendlier login system” login function on page 173 and the logout function on page 177 (if the particular session store does not actually delete the session record, you might need to session[:user_id] = nil before calling reset_session on login and/or logout)

    2008-12-30
    44OK

    In Ubuntu 8.04 (Hardy) the gems directory is not part of the path. In 8.04, gems are located in /var/lib/gems/1.8/bin Just add that your path (probably in /etc/profile) and source it.

    (Sam says: That’s described on page 37 of B1.6)

    2008-12-26
    37ERROR

    The current version of ubuntu does not seem to have a working copy of gems. I get strange error messages when I try to update. Just download ruby + gems from the ruby on rails website.

    2008-12-26
    577TYPO

    Visual effect “togglers” are slightly incorrect.

    toggle_appear: should be the symbol :toggle_appear
    toggle_slide: should be the symbol :toggle_slide
    toggle_blind: should be the symbol :toggle_blind

    See hxxp://api.rubyonrails.org/classes/ActionView/Helpers/ScriptaculousHelper.html#M001229

    2008-12-30
    91OK

    In the code listing for class AddTestData, there is a string delimited by %{ }. This string is not oblique like other strings in the code listing, except for the characters ‘s a foundational piece of any project’ which happen to be between single quotes.

    2008-12-26
    181OK

    Some junk characters seem to have gotten into the Task G title page:
    “spam∧H∧H∧H∧Hmailing” in the first paragraph

    (Dave says: It is a joke, perhaps a bit of an inside one, but a joke nevertheless.)

    2008-12-26
    261OK

    puts string.at(2) #=> “w”

    Should that not read “o” instead of “w” as “o” is the 2nd character in the string?

    i.e.

    puts string.at(2) #=> “o”

    (Sam says: the method counts starting at 0)

    2008-12-26
    136OK

    Just a heads up, using Aptana 1.2 the fade code doesn’t seem to play nice. It works in IE 7 and Firefox 3.0.4 fine outside the IDE, but inside it throws an error. When the store page is first loaded IE in the integrated preview inside Aptana give a runtime error with Line: 335 / Error: ‘Autocompleter.Base.prototype.getTokenBounds’ is null or not an object.

    If you hit No, the page loads fine, however the new fade gives an RJS error: [object Error] when you try and add an item to the cart. Again, this doesn’t occur outside Aptana, but in the event anyone is using it I figured I’d report it.

    2008-12-26
    133OK

    one more thing that can prevent the AJAX from working: when I saved add_to_cart.js.rjs in UTF-8/DOS mode (UltraEdit on Windows), it wouldn’t work. I had to save in in ASCII.

    2008-12-26
    227OK

    I’ve read section 13.4 thoroughly. Several times.

    All the content describing the code for the integration test is fine and easily understandable. However, after the full source of the integration test, there’s nothing - the text jumps straight to the optional DSL-specific content.

    There simply isn’t anything that mentions what you do with the integration test.

    Sure you have the source code [which is replicated in the appendix, so why it needs to be restated immediately after it was explained piece-wise already…I don’t know] but the source needs to be accompanied by some indication about what to do with the integration test, and why integration testing is important.

    2008-12-30
    227OK

    [Separate] Suggestion: move the DSL content to the end of section 13.4, rather than smack-bang in the middle where it effectively interrupts the flow of the content.

    2008-12-30
    -TYPO

    hxxp://www.pragprog.com/titles/rails3/agile-web-development-with-rails-third-edition —- release dates says March 15, 2008. I think you mean March 15, 2009.

    2008-12-30
    91OK

    delete ‘scaffold’ from the line
    <%= stylesheet_link_tag ‘scaffold’, ‘depot’ %>
    in the products.html.erb code snippet. Correct is
    <%= stylesheet_link_tag ‘depot’ %>
    The book says to add ‘depot’, but no mention of deleting ‘scaffold’. When you keep ‘scaffold’ in there, the page does not reflect the new css, and instead looks really bland (no cycling css, no dotted underline, etc.)

    (Sam says: In my testing, and in the downloadable files, keeping both in there works just fine.)

    2008-12-26
    312ERROR

    You write the following:

    1. Works
      User.find(:all, :conditions => [“name like ?” , params[:name]+“%” ])

    However, I could be wrong, but I believe this is opening your database to SQL injection. For example, if the user submits the name “%foo”, then the substituted value will be “foo”, which is not the programmer’s desire.

    2008-12-26
    54OK

    After

    <% 3.times do -%>
    Ho!

    <% end %>
    Merry Christmas!

    The output isn’t:
    Ho!

    Ho!

    Ho!

    Merry Christmas

    Because it wouldn’t show the breaks

    (Sam says: view the page source)

    2008-12-26
    50OK

    When I edited the comntroller to add the say action and saved the file then refereshed my webpage I got an error ‘unable to find the path’ I killed and restarted the webrick server and it worked perfectly.
    I am using the InstantRails install on windows XP.

    (Sam says: this is a non-deterministic bug in Rails. DHH is aware)

    2009-02-13
    168SUGGEST

    seem to be switching back and forth between ‘redirect_to(:action=>:index)’ (p165) and ‘redirect_to(:action=>“index”)’ (p168).

    Be consistent. (or need to explain that they need the same thing)

    2008-12-26
    491TYPO

    Is there supposed to be a page break here?

    2008-12-26
    497TYPO

    “If the image path doesn’t start with a / character, Rails assumes that it lives
    under the /images directory. If it doesn’t have a file extension, Rails currently
    assumes .png, but this will be an error in Rails 2.0.”

    This needs to be updated.

    2008-12-26
    80OK

    On my computer using the InstantRails install it does not give me a time stamp it just numbers the migrations 001 002 003. So the discussion about the timestamp should either be modified or removed.

    (Sam says: Be sure to follow the instructions on page 35 of B1.6 to upgrade Rails to 2.1 or later.)

    2008-12-26
    37ERROR

    In the installation of Linux (Ubuntu 8.10 here)..

    The -y apparently isn’t needed any longer for the line:

    sudo gem install -y rails

    Upon running this command, there’s an INFO: ‘gem install -y’ is now default and will be removed

    2008-12-26
    595TYPO

    “Rails will automatically set the content type of the e-mail to the content type
    in the filename. For our previous example, we could have set the view filename
    to sent.text.erb, and Rails would have sent it as an HTML e-mail automatically.
    But there’s more.”

    .text.erb should be .html.erb

    2008-12-30
    184OK

    ‘curl’ and ‘wget’ are not available on Windows boxes, please provide alternatives

    (Sam says: I’ve used both on Windows for years…)

    2008-12-26
    328TYPO

    class Customer < ActiveRecord::Base
    composed_of :name, :class_name => Name, …
    end

    Above code makes an error. It must be

    class Customer < ActiveRecord::Base
    composed_of :name, :class_name => “Name”, …
    end

    2008-12-26
    645TYPO

    Hello

    You wrote :

    “They are not included in the Appendix C, on page 684, but they
    are onlin and can be downloaded.”

    There is an “e” missing in “online”

    2008-12-26
    588ERROR

    “:authentication =>…
    …There is currently no way of using TLS (SSL) to connect to a mail server from Rails.”

    Suggestion: look at Recipe 47 in Advanced Rails Recipes, p. 263. In particular, the reference to a third-party TLS plugin. [It has improved a little since ARR went to print.]

    2008-12-26
    193OK

    In 13.2 Unit Testing of Models:

    The generated test classes by Rails 2.1 and newer start with

    require ‘test_helper’

    instead of

    require File.dirname(FILE) + ‘/../test_helper’

    … which also prevents to run a single unit directly from the terminal (page 194) without an error like:

    test/unit/product_test.rb:1:in `require’: no such file to load — test_helper (LoadError)
    \tfrom test/unit/product_test.rb:1

    (Sam says: That’s why the book suggests “ruby -I test …”)

    2008-12-26
    177TYPO

    The following piece of code miss an “@”

    flash[:notice] = “User #{user.name} deleted”

    It should be :

    flash[:notice] = “User #{@user.name} deleted”

    2008-12-26
    634SUGGEST

    Please consider dropping the instructions for mod_proxy_balancer + mongrel, and moving to Apache+Passenger.

    IHMO the writing is on the wall for anything apart from Apache + Passenger…and it seems to be the opinion held by a good many other people too.

    2008-12-26
    17TYPO

    Not necessarily a typo; it may be a stylistic choice. In the first paragraph it says, “It has won awards, and, more important, it…” I would expect the phrase to be “more importantly,”

    2008-12-26
    415TYPO

    line of script/console output truncated, shown as TRUNC in PDF.

    2009-01-02
    4949OK

    “count the number of each different word occurs in a file” SHOULD BE “count the number of [times] each different word occurs in a file”

    (Sam says: I can’t find this text)

    2008-12-26
    141OK

    the code on page 141:
    —-
    format.js if request.xhr?
    format.html{ redirect_to_index }
    —-
    seems like the second line will be called in both js and html variants - what is a logical error in this case

    (Sam says: Both statements simply define what formats will be accepted)

    2008-12-26
    605TYPO

    Under the headline “XML-RPC”, the sentence:
    “It generally is more popular a number of scripting languages …”

    does not feel right. I think the word “with” may have got lost somewhere and it should have been “.. more popular with a number of …” or something to that extent :)

    2008-12-30
    68OK

    ‘)’ missing at the end of the following line:
    (in this case, just the csv_reader.rb file.

    (Sam says: I can’t find this text - in fact, there is no “csv” in the entire book.)

    2008-12-26
    92OK

    The “Download depot_c/app/views/products/index.html.erb” code page on the website is partially interpreted and doesn’t show the correct code to copy

    (Sam says: Unfortunately, that’s your browser trying to be helpful. View source.)

    2008-12-26
    360OK

    “Is you undefine” - should be “If you undefine”…

    (Sam says: I can’t find this text)

    2008-12-26
    337TYPO

    The word “Rails” is used twice in a row in the following sentence: “If you used some other name, you’ll need to add a :foreign_key declaration so Rails Rails can find it.”

    2008-12-26
    49OK

    Because the latest version of Rails uses Mongrel for script/server, readers that are following along won’t see the predicted output unless they either restart the webserver or specify WEBrick.

    (Sam says: I’m not following, this doesn’t match page 49 nor is it specific enough for me to track down)

    2008-12-26
    548TYPO

    In the section “Updating the Page”, second paragraph (after the first bulleted list), “If your AJAX return HTML snippets …” should be either “If your AJAX returns …” or “If your AJAX calls return …”, probably the latter.

    2008-12-30
    109SUGGEST

    It looks like the latest version of Rails may have created session key id and the secret in the environment.rb. See the assign statement for config.action_controller.session.

    2008-12-26
    174TYPO

    missed:

    rm app/views/layouts/order.html.erb

    2008-12-26
    93OK

    In the following code line (as well as the related explanation that follows):

    <h truncate(product.description.gsub(/<.*?>/,’’), 80)>

    There is no need to use h, as all the HTML tags were already removed by gsub.

    (Sam says: That gets rid of the tags, but not the entities (things like &))

    2008-12-26
    82TYPO

    At bottom of p. 82 script is not closed.

    <%= link_to ‘Destroy’, product, :confirm => ‘Are you sure?’, :method => :de…TRUNC

    2009-01-02
    742TYPO

    I see “Static scaffold, see Scaffold, static” but I don’t see “Scaffold, static”.

    2009-01-02
    20TYPO

    The book states that the code has being run against Rails 2.1.2 in ‘Rails Versions’, however on p. 32 you mention 2.2.2 Rails RubyGem as the Rails version used to prepare this book.

    2008-12-30
    32TYPO

    Ruby team recommends using 1.8.7, not 1.8.6

    2008-12-30
    36TYPO

    Page 36 first final of the first paragraph : “How to ugrade your version of RubyGems is described in the sidebar on this page.”

    The word ‘ugrade’ lacks the p letter being ‘upgrade’ the right word.

    2008-12-30
    206TYPO

    Beta 1.7, end of page 206 - start of page 207. The YAML file does not include the currency format.

    2008-12-30
    207TYPO

    Beta 1.7. Instead of the Checkout.html.erb, the file _cart.html.erb is shown.

    2008-12-30
    31ffOK

    The version - which i bought a few days ago online (not being aware that it was out of date) is version 2006-2-16

    I edit SayController

    When i run it i got stuff about mysql. So i mucked around and finally found the yml file, and edited it to put the correct password in (as my mysql server is passworded). Had no effect, but I made the template, still getting the error Access Denied using password NO - so why is the pw not being picked up?

    Ive read a long way past that point, as its a bedtime read, and this morning started to try and do it, and this is the result. Not very impressed.

    (Sam says: If you “got stuff about mysql” you aren’t running a recent version of Rails; try looking at chapter 3 “Installing Rails”)

    2008-12-30
    20OK

    In paragraph 1, line 7, “gem_server” appears to be misspelled as “gem server”, i.e. with a space rather than an underscore.

    (Sam says: gem_server became “gem server” in release 0.9.5)

    2008-12-30
    35TYPO

    The link to Darwin Ports doesn’t work anymore.
    Should replace Darwin Ports in the text for MacPorts.

    2008-12-30
    526TYPO

    If page size is 30, then page=2 should generate rows 31-60, not 11-20.

    It would be nice to show the :per_page option, or at least mention it.

    2008-12-30
    524ERROR

    link_to( image_tag(…) ) to a destructive action should apply :method => ‘POST’, not just use a javascript confirmation.

    As preached elsewhere in the book.

    2008-12-30
    104OK

    It’s probably a good idea to add “:action => ‘add_to_cart’” to the button_to call - otherwise it’s not clear how pressing this button translates to controller action.

    (Sam says: For now, there is no action associated with the button, that comes on page 112)

    2008-12-30
    276OK

    Actually, a logger isn’t necessarily available to all code in a rails app, as claimed in the logging section.

    For instance, when trying to debug the depot’s Cart and CartItem classes in iteration C, no logger is available.

    I corrected this with `logger = Rails.logger`, though I bet there’s some better way to do it.

    (Sam says: The problem is that Cart and CartItem don’t inherit from ActiveRecord.)

    2008-12-30
    146ERROR

    In CreateLineItems listing, lines with CONSTRAINT definitions are commented, however, on the next page you say “The database now know about the relationship between line items, orders, and products”.

    2008-12-30
    149OK

    In _cart.html.erb listing, “Empty cart” is still a button_to call, despite being AJAXified in the previous chapter.

    2008-12-30
    174OK

    We haven’t created depot_p/app/views/layouts/admin.html.erb - which means that our login form is ugly and our flash does not appear if we enter password incorrectly. I understand that we’ll put the login form on the sidebar later, but it’s probably worth mentioning here.

    (Sam says: app/views/layouts/users.html.erb is created on page 170)

    2008-12-30
    301OK

    Its actually a ‘technical error’ with the formatting rules - the last line has coloured itself as code (blue), not as the wrapped comment line (green) ….

    (Dave says: sorry—sometimes the syntax highlighter gets confused. Nothing easy to do about it, I’m afraid)

    2008-12-30
    169OK

    missing arrows, which indicate changes in source listings (index.html.erb and new.html.erb)

    (Sam says: # In the former, it is hard to put arrows on deleted lines, in the latter, pretty much every line has changed (e.g., br tags dropped, size tags added)

    1. 36699: Each request creates a new instance of the controller. See figure 4.3. )
    2008-12-30
    221ERROR

    In paragraph 2, the following statement is probably false:

    In the Rails-generated fixture only the id attribute is set.

    2008-12-30
    230TYPO

    console log shows exactly two assertions passed (using Rails 2.2.2)

    2008-12-30
    231TYPO

    We have to remember to add the fixtures directive to the login controller test class.

    shouldn’t it be “admin controller test class”?

    2008-12-30
    245TYPO

    The generated file is different for me - it looks like

    require ‘test_helper’

    class UserStoriesTest < ActionController::IntegrationTest
    fixtures :all

    # Replace this with your real tests.
    test “the truth” do
    assert true
    end
    end

    (Rails 2.2.2, Ruby 1.8.7)

    2008-12-30
    279TYPO

    Chapters 17 and 19 are not hyperlinks in pdf-version of the book.

    2008-12-30
    111OK

    I find this code ambiguous (add_to_cart, line 2):
    @cart = find_cart
    If I understand correctly, the store controller instance is shared by all users. And the point in find_cart is to have a separate data space per user. So why are we using an instance variable, instead of a local variable ?

    (Sam says: Each request creates a new instance of the controller. See figure 4.3.)

    2008-12-30
    133OK

    Why not describe button_to_remote() instead of form_remote_tag()?

    After testing it out, we see that although button_to_remote() actually does work, it’s not progressive enhancement, so older browsers won’t get the functionality. form_remote_tag() has the options needed for progressive enhancement.

    That seems like a bug in button_to_remote(), but unless it’s fixed, I would suggest adding a “Joe asks” sidebar for this issue. Or, better, “Randy asks” :)

    (Sam says: I think you answered your own question :-)

    2008-12-31
    40SUGGEST

    “NetBeans IDE 6.1”, change to “NetBeans IDE 6.5”, since there is a new fresh version with a bug fixes and news.

    2008-12-31
    30TYPO

    Last paragraph of page, line 2.

    “The most common templating scheme, called ERb, embeds snippets of
    Ruby code within a view document using a Ruby tool called ERb (or Embedded
    Ruby).”

    Shouldn’t it say something like the following as ERb is mentioned twice in the one sentence?

    “The most common templating scheme embeds snippets of
    Ruby code within a view document using a Ruby tool called ERb (or Embedded
    Ruby).”

    2008-12-31
    104OK

    Adding the “button_to” command to the index page causes scroll bars to appear on Firefox for the Mac. Scroll bars do not appear in Safari.

    (Sam says: I think I prefer to leave the text as it is)

    2008-12-31
    154OK

    To check that the order is loaded into the database you can also call the orders and line_items controllers

    (Sam says: I think I prefer to leave the text as it is)

    2008-12-31
    664TYPO

    TRUNC code

    2009-01-02
    15TYPO

    “It has won awards, and, more importantly, it has become the framework of
    choice…” is a little over-comma’d—I’d make it “It has won awards and, more importantly, it has become the framework of choice…”. (If “more importantly” were not there, I wouldn’t have a comma in front of the “and”.)

    2008-12-31
    114SUGGEST

    While we might be “confident in our Rails-fu”, a little explanation of the Ruby syntax for the @items.find {|item|…} line might be helpful. On page 19, you mention that “When we use a Ruby-specific construct for the first time, we’ll cross-reference it to that appendix” - no such cross-reference exists.

    2008-12-31
    93OK

    <%=h truncate(product.description.gsub(/<.*?>/,’’),
    :length => 80) %>

    It doesn’t run in my current Rails version. The book is for Rails 2.0 and RubyGems 2.1.2, but I don’t know if it’s affected.

    It just say this error: “undefined method `-’ for {:length=>80}:Hash”

    I found something about it in Google, but are not allowed hyperlinks here.

    (Sam says: update to Rails 2.2.2)

    2009-01-02
    683TYPO

    config.time_zone paragraph… Active REcord.

    2008-12-31
    313TYPO

    The ‘#’ sign used for substitution ( as in #{} ) is causing your formatter to color a portion of the string as a comment in several strings on this page

    (Dave says: indeed it does. Not much we can do, I’m afraid)

    2009-01-02
    348OK

    order=Order.find(123)
    order.update_attribute(:name,“Barney”)
    ————————————-
    order=Order.find(321) <<<<—- I assume should also be ‘123’
    order.update_attributes(:name=> “Barney”,
    “barney@bedrock.com”)
    :email=>“barney@bedrock.com”)

    (Dave says: it’s a different row)

    2009-01-02
    00000SUGGEST

    It would be cool if this errata page could be filtered by the "
    Typo,Tech,Error,Suggestion,Not a problem,Next edition" categories

    2009-01-02
    195TYPO

    Starting from page 194 in B1.7:
    (Your numbers will be different from this, if for no other reason than you probably won’t have written tests yet. That’s the subject of the next chapter.)

    It looks like the “next chapter” is now “Internationalization”. “Testing” is the chapter after the next.

    2009-01-02
    284TYPO

    2nd paragraph: On Rails 1.8, mb_chars returns self, but on Ruby 1.8 it wraps the
    string in a multibyte proxy.

    2009-01-02
    284TYPO

    2nd paragraph:

    On Rails 1.8, mb_chars returns self, but on Ruby 1.8 it wraps the string in a multibyte proxy.

    One of the ‘1.8’ should be ‘1.9’ I think.

    2009-01-02
    527OK

    Will paginate wiki says the only officially supported Rails versions are 1.2.6 to 2.1.0. Is it a bug in the wiki, or should you warn the readers about potential incompatibility with Rails 2.2.2 which is describe in the book?

    (Sam says: we’ll leave the text as it is)

    2009-01-02
    122TYPO

    There is no indicator pointing out the additional line (button_to…) to add_to_cart.html.erb

    2009-01-02
    182OK

    The code that beings with “product = Product.find(some_id)” seems like it’s out of place. If you plug in the code into IRB it functions up until the logger.info line. Maybe wrap the code in some kind of example or better explain its use in script/console.

    2009-01-07
    190OK

    Chapter 12.2. Now is where you mention documenting your code. I would suspect that most people at this point have not documented anything. You should probably mention the reader should write documentation and how and give brief examples of decent documentation.

    2009-01-07
    77OK

    You use the scaffold command, but this is the first time it is mentioned in the book. What is the scaffold command? There should be at least a footnote about what it is.

    2009-01-07
    663TYPO

    spelling: “Preping” should be “Prepping”.

    2009-01-07
    136OK

    Where is says “sports”, should be “supports”.

    2009-01-07
    224ERROR

    now that we are using rails 2.2 the generator generates integration tests as “test ‘the truth’ do\
    assert true \
    end” In the book it still uses “def test_name_here\
    end”.

    2009-01-07
    42ERROR

    I am the current maintainer for the SQL Server adapter. The project can be found on Github at github.com/rails-sqlserver/2000-2005-adapter/tree/master. This project is the only one that I know of that is passing ALL the ActiveRecord tests. The Github rails-sqlserver account will also feature an adapter for SQL Server 2008 soon. This should negate the copy on the next page. If needed, I could even write up a replacement if needed. I’m ken at metaskills dot net.

    2009-01-07
    662ERROR

    Concerning the “touch tmp/restart.txt” command: Where is the restart.txt file supposed to live on the server? I can’t see any such file inside the tmp folder on the server, and neither do I see it in /tmp. Thanks.

    2009-01-07
    661SUGGEST

    In reference to the second step, “sudo passenger-install-apache2-module”, on OSX, you may want to suggest installing (optional) Developer Tools from the OSX disk since devtools must be installed for this step to work.

    2009-01-07
    663TYPO

    between the code segments 2/3’s way down:

    “phyiscal” -> “physical”

    2009-01-07
    283SUGGEST

    It’d be great to see some example usage for each_with_object

    2009-01-07
    667SUGGEST

    In chap 28.4 I’d make it a bit clearer what is git commands to update app content on the server, and what is acutally Rails/Deployment related commands. E.g. the “Rinse, Wash, Repeat” text I would suggest that it is said that the three git commands serves the purpose of bringing the working copy on the server up to date, while the cap command is the actual deployment part.

    2009-01-07
    185OK

    Last sentence before section 12.1 - mailing ^H^H^H^H system

    2009-01-07
    665TYPO

    The file download at this page refers to deploy/deploy.rb. Shouldn’t it rather be config/deploy.rb? Thanks.

    2009-01-07
    163SUGGEST

    Could I suggest to replace
    “errors.add_to_base(”Missing password" ) if hashed_password.blank?" by
    “errors.add(:password, ”Missing password" ) if hashed_password.blank?" ?
    This permits to enable the css red selection of password input when blank.
    Thanks for your book !

    2009-01-07
    510TYPO

    second bullet point for “Fixing the GET problem” is empty

    2009-01-07
    347TYPO

    I think this:

    named_scope :last_n_days, lambda { |days|, :condition => …

    should read:

    named_scope :last_n_days, lambda { |days| :condition => …

    2009-01-07
    198TYPO

    End of second line from the top of the page. Currently says, “It’s a funny name, but is sure beats typing
    out…”
    Change “is” to “it”:
    “It’s a funny name, but IT sure beats typing
    out…”

    2009-01-07
    270SUGGEST

    Statement is out of date. In the box titled “When Is Running on the Edge a Good Idea?” that last sentence of the first paragraph is out of date (applied in previous edition, not this one):

    “The latest drive for RESTful interfaces has been similarly available for months ahead of the 1.2 release.”

    2009-01-07
    510TYPO

    Second bullet in first set of bullets doesn’t have any content, looks like:

    • First paragraph of the first bullet. I like bullets, my gun uses bullets. But they’re only used for the good of all mankind.

    Oh second Paragraph of first bullet, how I love the first bullet, I’d rather stay with the first bullet, because I belong here.

    *

    • First Paragraph of the third bullet. I am lonely, and feel distant from my friend, the first bullet, please make me a new friend.
    2009-01-07
    664TYPO

    spelling, 2/3 way down:

    “.gitinore” -> .gitignore

    2009-01-07
    665TYPO

    spelling typo at midpage:

    “recipies” -> recipes

    2009-01-07
    665OK

    "# As Capistrano executes in a non-interactive mode and therefore doesn’t cause

    1. any of your shell profile scripts to be run,"

    does not seem true to me. I modified .bashrc to add PATH=/opt/local/bin:/opt/local/sbin:$PATH
    so that git would run remotely, and it worked. So, I believe that .bash_profile does not get run, but .bashrc does get run by the ssh command (or whatever git is using).

    Not sure how the other shells deal with rc files, but I would be surprised if bash is much different than (say) sh in this behavior.

    If you’re going to address this issue, I suggest addressing it before the git commands at the top of this page (665). That way, the reader can make a purposeful general change that makes a visible difference (git breaks … git works). You may want to include the MAN_PATH also (though I changed mine in /etc/man.conf: “MAN_PATH /opt/local/share/man” to pick up any gem web pages systemwide).

    Then of course, you probably want to find an excuse to put something in the environment the ruby way as described, to teach this mechanism as well (e.g., the GEM_PATH as is?).

    So, it might be good to suggest these various hooks to defining the environment, and to do so at the first usage of git. That’s where git broke for me, and I had to figure out where “best” to fix it.

    (Sam says: that’s not what I see. See Wikipedia on Bash#Startup_scripts)

    2009-01-07
    666ERROR

    Version changes? On my system, “cap deploy.setup” does not work. Neither does “cap deploy.check”.

    How about:
    cap deploy:setup
    cap deploy:check
    ?

    2009-01-07
    113TYPO

    “On line 2 we use the params … request, then calls …, then saves …” -> “On line 2 we use the params … request, then call …, then save …” or “Line 2 uses the params …”

    2009-01-07
    69TYPO

    Missing ‘as’ in ‘everything should work described’

    2009-01-07
    667OK

    @ top of page:

    "[…] it should go smoothly.

    $ cap deploy:migrations
    "
    Suggestion: If it doesn’t go smoothly, make sure you have properly customized your deploy.rb. Then make sure you commit it and push it to the server, so the server has the correct Capistrano configuration information as well. Once all is in order,
    cap deploy:migrations should go smoothly.

    2009-01-07
    200OK

    “Now, when we change the value, the value will still snap back to English, but
    at least we can see an message on the screen saying that the translation is
    not available, and a message in the log indicating that the file wasn’t found.”
    That’ss not what I see at that stage… the popup sticks to Español, and I don’t see an error message, and there isn’t one in the log file.

    (Sam says: unable to reproduce)

    2009-02-13
    529TYPO

    The edit.html.!>>>missing e<<<!rb template is called.
    It uses the information in the user
    object to generate…

    2009-01-06
    46ERROR

    The text at the bottom of the page refers the reader to figure 4.1, the welcome screen that the webrick server displays. The text says that the version numbers that the user will see will be different than what’s in the figure. Except that there are no version numbers in the welcome screen as displayed in figure 4.1!

    2009-01-07
    662TYPO

    First bullet point “… include a RailsEnv directive in the each VirtualHost …” s/b “… include a RailsEnv directive in each VirtualHost …” (remove the word “the”)

    2009-01-07
    590SUGGEST

    p590: drag-and-drop
    p596: Drag and Drop in hed
    p597: Drag-and-Drop in hed
    p739: Drag and drop

    Consistency consideration in a great book

    2009-01-07
    59OK

    Example shows how to link with a static HTML link as “say/goodbye” and “say/hello.” This does not work because the relative path is referenced from within the “say” directory. This example instructs the browser to request “say/say/hello” and “say/say/goodbye.” The issue appears on both pages 59 and 60.

    (Sam says: the links actually read and

    2009-01-07
    507TYPO

    …“good for”, suggesting that the client need not re-request this daga in the interim. Calling…

    daga => data

    2009-01-07
    151OK

    The first line of the form_for uses a symbol (:save_order) as a target of the :action which is inconsistent with the other examples up to this point which have used strings (“save_order”).

    Personally the symbol format works better for me (just say no to strings!) and ideally the book should be updated to be consistent across examples and it might be worth pointing out that both formats can be used.

    (Sam says: No uses of form_for in the book use a string)

    2009-01-26
    134OK

    A little diagram here explaining how the different bits of code work together for the AJAX to work correctly would have made it easier for me to go through the example and understand how it fits together…might help reduce the number of people that struggle to get this to work.

    2009-01-26
    539SUGGEST

    I don’t know how you feel about cross promotion but I think adding a pointer to Ryan Bates’ excellent Multiple Models in one Form recipe in Advanced Rails Recipes at the end of the Multiple Models in a Form section of AWDWR3 would be very helpful. I own both but when the technique in AWDWR3 didn’t work in one of my apps it took me a long time to remember to try Ryan’s method, maybe this shortcut will save someone else a lot of time?

    2009-01-26
    398398ERROR

    This error actually starts on page 398 and extends to the following page. It is a conceptual error caused by recent changes to Rails.

    In a nutshell, Rails no longer tries to combine all :included SQL queries into one giant one. Instead, the default behavior now seems to be to run one query per table, using a WHERE … IN syntax to bring in the needed rows from each “joined” table.

    So, for the example on p. 398, there will first be one query to the posts table, then one query to the authors table (fetching just those authors associated with the posts), then 100 queries to the comments table. Thus, the final sentence of the paragraph should change to something like, “If there are 100 posts, the following code will eliminate 99 queries to the authors table compared to the previous example.”

    Moving on to page 399, the leading sentence is incorrect; it should read something like “And this example will bring it all down to just three queries.” And then the block of text starting with “Under the covers…” (all the way to the end of the paragraph) needs to be reviewed carefully and rewritten.

    Finally, I think it would be really helpful to include some prose and an example or two of more complicated preloading declarations. The RDoc gives examples, but waves hands at precisely how you construct the nested arrays and hashes to preload multiple tables using different relations. I have figured it out on my own, but I have to rethink it each time.

    Hope that helps!

    2009-01-26
    197TYPO

    Middle: Change from “… in the top right hand side of the layout …”, to “… in the top right-hand side of the layout …”. [Combine ‘right hand’ with hyphen to ‘right-hand’ to make compound adjective]

    2009-01-26
    199TYPO

    Bottom: Change from “Finaly, if the locale …” to “Finally, if the locale …”. [Spelling error]

    2009-01-26
    199TYPO

    Bottom: Change from “… we can see an message …” to “… we can see a message …”. [‘an’ to ‘a’]

    2009-01-26
    203TYPO

    Top: Indent YAML name ‘add:’ by one more space to be consistent with a 2-space indentation.

    2009-01-26
    204TYPO

    Middle/Bottom: Indent YAML names ‘empty:’ and ‘checkout:’ by one more space to be consistent with a 2-space indentation.

    2009-01-26
    206TYPO

    Change from “Now we feel that are in the home stretch.” to “Now we feel that we are in the home stretch.” [Looks like the second word “we” was forgotten?]

    2009-01-26
    209TYPO

    Bottom: Should the YAML ‘es’ name values be surrounded by double quotes instead of single quotes, i.e. “pedido” versus ‘pedido’ as is done in the previous example YAML files?

    2009-01-26
    210TYPO

    First sentence: Add a period (“.”) or colon (“:”) to the end of the sentence “We need to update the flash messages”.

    2009-01-26
    566OK

    As far as I understand, the material in this section is out-of-date wrt current Rails. I tried the rdoc_template example and it fails with

    undefined method `compile’ for #

    In fact I have a few custom handlers I’m not sure how to convert to Rails 2.2.2 and I’m anxious to see this example updated.

    (Sam says: footnote added. Works in 2.2.1 and is expected to work again in 2.2.3.)

    2009-01-26
    42ERROR

    Thanks for adding the SQL Server adapter link. However, I should have thought about the link more. Since we are starting work on the 2008 adapter version for 2.2.2 and up, can the link be changed to just this.

    github.com/rails-sqlserver

    I also noticed that the link was not hyper linked and pink like the others too. Thanks again, Ken

    2009-01-26
    281OK

    The beginning of section 16.1 leaves the reader with a bit of a “huh?”

    It starts off with converting objects into JSON and YAML, then the “David Says” block talks about extending numbers, then the next section of text presents the blank? method.

    Extending numbers is not covered in the text until five pages later on 287.

    Lots of jumping around there, which is not obvious when you understand the topic - open classes, but to a new reader it’s pretty disjointed.

    2009-01-26
    306ERROR

    The Ruby code includes:

    :options => “auto_increment = 10000”

    and the generated DDL provided is listed as:

    … AUTOINCREMENT NOT NULL

    Shouldn’t the DDL be:

    … AUTO_INCREMENT = 10000

    2009-01-26
    660OK

    For apache2, it’s apache2ctl, not apachectl

    (Sam says: see footnote)

    2009-01-26
    666TYPO

    “All you need to to is check your …” should be “… to do …”

    2009-01-26
    590OK

    I have found a error on the link to install autocompletion pluggin, searching on the web i found the correct link:

    git://github.com/rails/auto_complete.git

    In order to install the pluggin:

    script/plugin install git://github.com/rails/auto_complete.git

    I hope that is useful.

    Greetings from Venezuela.

    2009-01-26
    426ERROR

    I’m not quite sure you can still do something like:

    Account.transaction(peter, paul) do
    paul.deposit(350)
    peter.withdraw(350)
    end

    without getting argument error in rails 2. I guess most of chapter about transactions should be revised and remove references to it.

    2009-01-26
    395OK

    Acts As Tree is no longer part of the standard Rails 2.x distributions..

    this is now available as several plugins.

    IMHO the acts_as_ordered_tree plugin should be covered in the new book.

    2009-01-26
    527OK

    the will_paginate plugin is very basic.

    IMHO the paginating_find plugin is essential, because it does the paging in the find, therefore limiting the number of results returned from the DB — essential for applications with a lot of record.
    GitHub: git://github.com/alexkwolfe/paginating_find.git
    Author: alexkwolfe@gmail.com

    2009-01-26
    94TYPO

    The latest depot CSS file doesn’t match what is shown on the screenshot.

    perhaps
    #product-list h1 {
    border-bottom: 2px dotted #77d;
    }

    I kind of remember it being in the depot.css file previously, but it is not there anymore.

    2009-01-26
    150OK

    In the code should it be like so, i.e. name rather than order_name in line 3 of the code to match to call to the text_field method with :name?


    <%= form.text_field :name, :size => 40 %>

    rather than


    <%= form.text_field :name, :size => 40 %>

    (Sam says: Actually, it is correct as is. The form helper inserts the object type name in front of the field name. The next page contains an example of usage of the form label helper that hides this.)

    2009-01-26
    359ERROR

    second-to-last line, comment should be:

    1. => {“name” => [“Dave”, “Dave Thomas”]}
    2009-01-26
    360TYPO

    Code line 4, comment:

    1. => [‘Dave’, ‘Dave Thomas’]

    s/b:

    1. => [‘Dave’, ‘Bill’]

    If the above assignment to ‘Bill’ is kept, then the last three lines of the code example are incorrect. To correct them the third-to-last line should be changed to:

    user.name = ‘Bill’

    2009-01-26
    660TYPO

    Footnote 2: “If deploying on Rails is a requirement for your installation” should be “If deploying on Windows is a requirement for your installation”.

    2009-01-26
    200TYPO

    The flash in the screenshot says “es-ES translation not available” where it should say “es translation not available”, as “es” is what was put in i18n.rb before, not “es-ES”.

    Just a minor thing, but I thought I’d mention it. :)

    2009-01-26
    206TYPO

    Typo: “acorss” instead of “across” (“  is a non-breaking space charac-
    ter, preventing this value from being split acorss multiple lines”)

    2009-01-26
    400401OK

    “There’s an important point in this DDL. The column must be declared with a default value of zero (or you must do the equivalent and set the value to zero
    when parent rows are created). If this isn’t done, you’ll end up with null values for the count regardless of the number of child rows.”

    It would be nice to also inform the reader at this point that this column becomes a read-only attribute in the database to rails.

    Which is particularly useful when you add a counter in after the system has been running and you would like to update this column with the correct starting number.

    This section on Counters also does not address habtm relationships. Which you would assume would work in a similar way; however, you would be mistaken.

    Just a suggestion. Thanks again.

    2009-01-26
    178OK

    Errata for earlier ebook has pointed out that the order_controller is incorrect here. Response stated that a later version would have an order_controller. This version does created an order_controller, but not until page 628. Therefore the link on page 178 doesn’t work because there is no order_controller yet.
    Do you still plan on including an order_controller prior to the code on page 178?

    <%= link_to ‘Orders’, :controller => ‘orders’ %>

    (sam says: The order scaffold is generated on page 145.)

    2009-01-26
    71OK

    “But before you do that, let’s start over. Delete all the files that Rails generated
    for you and generate a new set. After all, you aren’t heavily invested in these
    files just yet.”

    Why delete the whole project just to use

    rails —database=mysql depot

    To me this screams —database=mysql flag does a lot more than edit the default look of database.yml. Does it?

    For me, this process leads me to think switching from SQLite to MySQL later in my development cycle will involve editing many files. Maybe I’m just reading the book too paranoid.

    2009-01-26
    221OK

    The lone line of code

    fixtures :products

    is a bit confusing as it breaks with the style of the examples from the former chapters. I’ve guessed the line should go right after the class declaration in depot_r/test/unit/product_test.rb, but I think it can be made clearer by writing

    class ProductTest < ActiveSupport::TestCase
    fixtures :products
    # …

    2009-01-26
    223ERROR

    The line

    assert_equal ActiveRecord::Errors.default_error_messages[:taken], product.errors.on(:title)

    is causing a deprecation warning.

    DEPRECATION WARNING: ActiveRecord::Errors.default_error_messages has been deprecated. Please use I18n.translate(‘activerecord.errors.messages’)

    2009-01-26
    1OK

    As a relative newb to Rails I’d appreciate a short paragraph somewhere about coding styles. For example, in the models, arguments for methods are passed in parentheses, while in the views this is usually not the case.

    This is quite a bit confusing, actually. I know that both styles work and that you’ve mentioned Ruby accepting either way, but still.

    I think a clarification about the way it’s done in the book (models: with parentheses, views: without) would help newcomers.

    2009-01-26
    139OK

    In the code for add_to_cart.js.rjs, the last line:
    page[:current_item].visual_effect :highlight,
    :startcolor => “#88ff88” ,
    :endcolor => “#114411”
    seems to cause a js error if no div with id=‘current_item’ is rendered by the partial:_cart_item.html.erb. I changed this code to the following:
    page[:current_item].visual_effect :highlight,
    :startcolor => “#88ff88”,
    :endcolor => “#114411” if cart.items.include?(current_item)
    \t\t\t\t\t\t\t
    where the trailing if clause assures an attempt to apply visual effect to a null row is not excecuted

    2009-01-26
    285ERROR

    When talking about using ActiveSupport::Inflector to alert rails of irregular plurals and the like, there’s a paragraph after the initial (failed) attempt at pluralizing the word “goose”, containing the sentence “At the bottom of the file environment.rb in the config directory you’ll find a commented-out section that configures the ActiveSupport::Inflector module.”. Unfortunately, the `environment.rb’ module doesn’t contain any mention of ActiveSupport::Inflector. Further, the last paragraph of the section (just before 16.5) correctly states, “In a Rails application, these changes can go in the file inflections.rb in the config/initializers directory.”

    2009-01-26
    337OK

    The code snippet for the `:limit’ option for ActiveRecord’s find method is broken across two pages, with only one line of the snippet on the next page (worse, it’s the actual `:limit’ option being demonstrated). Might be easier to read if this was all on one page.

    (Dave says: we do layout when the book is finalized)

    2009-01-26
    569OK

    The search example
    When I try to run the downloaded code, I get the following:
    script/server —debug
    ./script/../config/boot.rb:33:Warning: Gem::SourceIndex#search support for String patterns is deprecated
    ./script/../config/boot.rb:36: undefined method `require_gem’ for main:Object (NoMethodError)
    \tfrom script/server:2:in `require’
    \tfrom script/server:2

    (Sam says: I’m not sure what’s going on here. The former indicates that the version of Rails you have installed is not compatible with the version of gems you have installed. The latter indicates that a “require ‘rubygems’” is missing.)

    2009-01-26
    76OK

    Missing:
    Before running scaffold migration you should edit migration file in directory db/migrate to permit overwriting of already existing table products
    by adding the parameter
    :force => true in create_table.
    The line of migration’s file should look like below:


    create_table :products, :force => true do |t|

    2009-01-26
    405OK

    On reading the chapter on Validation, it was not clear to me that ‘model’ is an instance of the the object being validated. I just wasted a few hours because of that, so maybe using another name would be a good idea.

    2009-01-26
    315TYPO

    in “Custom Messages and Benchmarks” paragraph:
    <…advanced migrations is to to output your…>
    “to” repeated 2 times.

    2009-01-26
    392ERROR

    might be a typo:
    ruby script/plugin install acts_as_list
    ruby script/plugin install acts_as_tree

    Returns a message that the Plugin is not found.

    However:
    script/plugin install git://github.com/rails/acts_as_tree.git

    Works as advertised.

    Additionally — it is not required to install acts_as_list to install acts_as_tree.

    2009-01-26
    326TYPO

    Section 18.4: “For example, the following call creates a connection to a SQLite3
    database called railsdb.sqlite3.” — The actual example uses the name “development.sqlite3”, not “railsdb.sqlite3”.

    2009-01-26
    84OK

    Middle: “You can fix this by deleting the h that appears on
    the @product.description line in app/views/products/show.html.erb.” Maybe a reminder to change index.html.erb in the same way.

    2009-01-26
    169ERROR

    The code of the users/new template has been changed in more places than mentioned in the text. The legend and fieldset tags have been added and the wrapping

    . Without all these changes the css doesn’t work.
    And moreover: shouldn’t the form fields be wrapped in

    and not in

    for correct style?

    2009-01-26
    426SUGGEST

    >Account.transaction(peter, paul)
    which ActiveRecord version supports parameters in its transaction class method?

    2009-01-26
    49OK

    In chapter 4 there is a trap for people trying to follow
    along who don’t have sqllite. It is this: for mysql,
    you have to create the database before it will do anything.

    If you don’t, if you just follow the instructions you have,
    you get “unrecognised database demo” (or similar).

    I’m fairly sure this is true, because a kind person on
    #rubyonrails told me so, and when I do the rake create &
    migrate commands (from later) then I get further.

    The other problem is that the default routes don’t
    support /say/hello.

    I installed rails 2.2.2 on mandrake linux, and the
    default routes that are in my routes.db expect
    there to be an id after the action.

    When I added an id-less route

    map.connect ‘:controller/:action’

    then the say/hello application works.

    2009-01-26
    70TYPO

    In section 6.1 you kindly make provisions for users
    like me who (mistakenly perhaps) thought that they
    have to stick with the database they have already
    installed.

    The only problem is that if they already have mysql,
    they probably have a password on it, and rake db:create
    isn’t going to work.

    I reckon you should put Create the Database
    just after the next bit (Configuration) so you can
    have already told us about editing config.db before
    you tell us to rake db:create.

    2009-01-26
    101OK

    The depot_e/app/views/layouts/store.html.erb link does not point to a downloadable source file… it renders the erb. Trying to copy and paste the listing brought useless line numbers with it.

    (Sam says: Depending on the browser you use, you may need to view-source)

    2009-01-26
    82SUGGEST

    What are the green triangles beside the code listing?

    I couldn’t see any reference to them in the text.

    2009-01-26
    85OK

    In this chapter, called “Validate” you tell us some things we can do to validate, but you give us no grounding in where this is coming from.

    We need a general description of what these validation methods supplied by rails are.

    For example, when is price_must_be_at_least_a_cent going to get called?

    What is the list of validate_xxx functions? Where do we look for that?

    (Sam says: See section 20.1)

    2009-01-26
    134OK

    Once the AJAX implementation is finished, if you empty the cart, there is no way to clear the flash statement on the main page created by the :

    def empty_cart
    session[:cart] = nil
    redirect_to_index(“Your cart is currently empty”)
    end

    Either redirect_to_index(nil) should be substituted or some method of updating this should be addressed.

    (Sam says: Don’t worry, in a few pages the flash will go away.)

    2009-01-26
    285TYPO

    Thanks for the great revisions to the AWD with Rails bible.

    I noticed a tiny oversight that might be improved if a small change is made to the following text, currently on page 285:
    —————————————————————————————————————————————————————————-
    “As with everything in Rails, if you don’t like the defaults, you can change
    them. Changing the automatic inflections is easy. At the bottom of the file
    environment.rb in the config directory you’ll find a commented-out section that
    configures the ActiveSupport::Inflector module. This lets us define new rules for
    forming the plural and singular forms of words. We can tell it
    • The plural of a word or class of words given the singular form
    • The singular form of a word or class of words given the plural form
    • Which words have irregular plurals
    • Which words have no plurals
    Our goose/geese pair are an irregular plural, so we could tell the inflector
    about them using
    ActiveSupport::Inflector.inflections do |inflect|
    inflect.irregular ”goose" , “geese”
    end"
    —————————————————————————————————————————————————————————
    When this code is pasted at the end of the environment.rb file, it results in an error.

    You do find out a short while later that this code belongs in the ../config/initializers/inflections.rb file.

    It just seems that the correcting the preceding text will be “more” precise.

    2009-01-26
    463OK

    “The full source code for this application, showing the additional views for comments,
    is available online.”

    How about a link or a URL to a zipped file containing the source for this app?

    2009-01-26
    402OK

    This bit of code uses ‘&&’ rather than ‘||’, yet the error message uses “name or an email”. This may be a question of style, but might it not be more correct to use ‘||’ in this context? Or change the text message?

    “def one_of_name_or_email_required
    if name.blank? && email.blank?
    errors.add_to_base(”You must specify a name or an email address" )
    end
    end"

    (Dave says: it’s actually correct as it stands. You have to supply one or both, so the if fails it you supply neither)

    2009-01-25
    pg90 OK

    Ver B1.9

    The CSS file that is available for download is missing part of the css class code that was in the early version (1st ed).

    An example is that when I used the latest PDF book I downloaded the depot.css but the login page had no format. When I looked in my early depot.css version I noticed that the section called /* Styles for order form */ is missing from the latest downloadable depot.css - I copied this in from my old depot.css & the formatting came good.

    Cheers Doug Marker

    2009-01-26
    173SUGGEST

    The top blue arrow in figure 11.1 isn’t on the end of the blue line, which protrudes from the end of the arrow a little.

    2009-02-13
    176OK

    The final ‘end’ of the excerpt from the StoreController on the previous page appears below the “A friendlier login system” box. Shouldn’t it appear above it? it looks funny just hanging there.

    (Dave says: this gets fixed during layout)

    2009-01-26
    603ERROR

    Minor detail but the text editor field currently shows ‘[No Name]’

    “Notice that the editor field has [No Value] in the text field…”

    2009-01-26
    638TYPO

    Should be “against the grain”

    “Authentication uses the underlying authentication mechanism that your website already supports, and doesn’t go againt the grain”

    2009-01-26
    182TYPO

    Second bullet - “Manually created a controller to handing login and logout and implemented a single-action login method…”

    Should be “handle”

    2009-01-26
    183TYPO

    Second item under “What We Just Did”:

    Manually created a controller to handing login and logout
    ^
    handle!

    2009-01-26
    357OK

    You may like to compare the concept of “Value Object” to const in C. This will be something lots of readers will be familiar with, and might save them doing what I did (re-reading the paragraph a few times to make sure I was understanding what it was telling me). If ruby had const then these would be const and you couldn’t change them even if you wanted to…

    Of course, if it’s not like const, then you might need to differentiate, because it sure sounds like const to me!

    2009-01-26
    113OK

    ON the first paragraph below the ‘Template is missing image, it says:
    What does Rails do after it finishes executing the add_to_cart action? It goes and finds a template called add_to_cart in the app/views/store directory….
    Instead of goes and finds it’s probably more appropriate to use ’goes and searches for’

    2009-01-26
    53OK

    In “Merry Christmas”, the example output contains
    after Ho!
    The html tag obviously doesn’t show in browser.

    2009-01-26
    92OK

    You haven’t told us what image_tag is - it’s new, so it deserves a bullet along with the other new things.

    I would also use (and those show us how to use) a different “alt” than “www”. I was using this page as a recipe for a new thingy, and had an invalid url the first time. My first listing had “www” in that spot, and I was thinking "wtf is this!?

    (While I’m here, I reckon this page (that I’m typing into) could be improved by highlighting that the small text above is the existing errata, and you should read it. Text that small, without any colour panel or anything, begs the eye to skip over it when you come looking for somewhere to type your all important new suggestion - it looks like “boilerplate”. I know that there’s a title there saying “Existing Errata”, but I would

    - Highlight the “have already been reported”
    - put another horizontal line at the bottom of that section
    - use some colour
    )

    GaJ

    2009-01-26
    6OK

    I would give the “Report Erratum” link at the bottom of all the pages a nice button-like background - maybe a soothing tan colour with rounded corners.

    It’s pretty subtle that it’s there - almost as if you want people to have to hunt for it before sending suggestions.

    (Dave says: personally, I think it’s a miracle it’s there at all…)

    2009-01-26
    6OK

    It would be nice to be able to put my email address here, and get a notification when you respond to (with “Sam says” or whatever) and when you update the text in relation to my suggestion…

    (Dave says: suggestions are probably best dealt with in the book’s forum. Over there, you can subscribe to an RSS feed to notify you of changes)

    2009-01-26
    90OK

    I think you need to make the warning that this migration is going to delete all the data rather more prominent.

    I also think that the migration is misnamed - it’s really “reset data” or “initialise data” not “add data”.

    2009-01-26
    223ERROR

    in the method test_unique_title1, I got this warning:
    DEPRECATION WARNING: ActiveRecord::Errors.default_error_messages has been deprecated. Please use I18n.translate(‘activerecord.errors.messages’)

    Therefore, the line should be changed to:
    assert_equal I18n.translate(‘activerecord.errors.messages’)[:taken], product.errors.on(:title)

    2009-01-26
    471OK

    It’s bizarre that throughout the whole book controllers render their views using respond_to, but here where we are in the chapter that is telling us the details of how to render, we’re now talking about a render method, and no reference to respond_to at all! (The only place we’ve seen render up till now is in in the instructions about how to do partials).

    Indeed, we have a whole section earlier on called “Responding Appropriately” which tells us to use respond_to, and doesn’t even hint that there’s render.
    This is in bizarre contrast to this section called Responding To The User that doesn’t hint at respond_to

    So far this has been the most irritating aspect of this book: it leaps into (IMHO) too much “lets just do cool stuff” without helping the user connect it to “what really matters”, and indeed (as typified int this case) not even connecting to “how it is all supposed to hang together” at all.

    end rant :)

    2009-02-13
    82OK

    I’m going to reinforce a previous comment about this page: there is far too much magic introduced here without talking about what it is.

    I had to visit #rubyonrails to figure out where on earth edit_product_path method magically appeared from, etc etc.

    Sam responded to the plural issue, but there’s much more that this example introduces that it doesn’t explain.

    2009-02-13
    82OK

    Note: (to my previous comment) you can’t just google for edit_product_path, or search in other places for it to find out where it comes from, because it’s name is generated.

    This is one reason why especially for these route-generated methods, you need to tell us what is going on.

    2009-02-13
    511OK

    Good advice.

    Seems like it would have been better if the depot took this advice … that even would have forced you to come up with a nice way of formatting index.html.erb that takes this into account. Then I could have copied that :)

    (At the moment you have

    <%= link_to ‘Destroy’, product,
    :confirm => ‘Are you sure?’,
    :method => :delete %>

    against your own advice!)

    2009-02-13
    129OK

    The paragraph starting with “there’s something subtle going on here” refers to a variable being set “each time around a loop”, without explaining how a loop gets going at all!

    I think you need to explain the function of :collection!

    2009-02-13
    244ERROR

    In the center of the page the text says:
    “In our unit and functional tests, our test had to be written with identifier
    names that started test_. IntegrationTest provides a convenient alternative via a
    class method named test that takes care of this for us, and even allows us to
    use spaces in test names.”

    In fact some of the functional and unit tests shown in previous sections already use the ‘test’ method described here as if it was exclusive to integration tests.

    2009-02-13
    254OK

    At the top of the page the sample code shows a setup method, while it fails to show the assignment to DAVE_DETAILS.
    The online sample has those right, the pdf content needs to be adjusted as per the online file.

    (Sam says: See page 247)

    2009-02-13
    567ERROR

    I think ActionController::Caching::Fragments::FileStore et al do not exist anymore. They’re not in Rails 2.2.2.

    These are in 2.2.2:

    ActionController::Base.cache_store = :memory_store
    ActionController::Base.cache_store = :file_store, “/path/to/cache/directory”
    ActionController::Base.cache_store = :drb_store, “druby://localhost:9192”
    ActionController::Base.cache_store = :mem_cache_store, “localhost”
    ActionController::Base.cache_store = MyOwnStore.new(“parameter”)

    2009-02-13
    186OK

    Wouldn’t it be better to limit access to these pages? The customers data shouldn’t be accessable generally.

    2009-02-13
    174TYPO

    In the end of the page there is the following code:

    class StoreController < ApplicationController
    #…
    protected
    def authorize
    end

    The closing ‘end’ is shown only in the next page, after a long text in a big gray box. Wouldn’t it be better to show it before the box?

    2009-02-24
    439TYPO

    fith row said
    => {:Controller=>“blog”, :anything=>[“junk”], :action=>“unknown_request”}

    replace Controller with controller

    2009-02-13
    501TYPO

    “:xhr => trueorfalse” should read “:xhr => true or false”.

    2009-02-24
    98TYPO

    Footnote 2 seems to be a bit too short. The Section 27.5 is only referenced thru one word.

    2009-02-24
    34SUGGEST

    You explain how to upgrade rails, but not ruby. Instant Rails 2.0 comes with version 1.8.6 ruby, but on page 32 you state that we should have 1.8.7.
    I tried the obvious
    gem update ruby
    but it failed because I don’t have nmake installed. I’m trying to figure out the best way to update.

    At this point it would be helpful to know of a forum where I could ask newbish questions such as this.

    Anyway, up to page 34 and so far I think you’ve done an excellent job.

    Thanks,
    Mark

    2009-02-13
    223SUGGEST

    At the bottom of page 223 where the cart_test.rb listing starts, the test case is using the older structure of the tests:

    def test_name
    end

    instead of the new one that is used by the scaffolding and throughout the Testing chapter:

    test “test_name” do
    end

    2009-02-13
    271OK

    As far as I can see, the namespacing p271 makes no mention of the fact that you need to tell it how it’s routed in routes.rb.

    Maybe I just can’t find it, but it’s not in the index either.

    (Sam says" I don’t understand this comment)

    2009-02-13
    123OK

    Not a CSS expert, but I think there should be a comma between the selectors in
    .total-line .total-cell {
    font-weight: bold;
    border-top: 1px solid #595 ;
    }

    (Sam says: In CSS, a comma would mean “either”. Space means “descendant”.)

    2009-02-13
    198OK

    locale_path = “#{LOCALES_DIRECTORY}#{I18n.locale}.yml”
    should be
    locale_path = “#{LOCALES_DIRECTORY}/#{I18n.locale}.yml”

    Also the begin of the rescue is missing. I placed one after the def set_locale

    (Sam says: LOCALES_DIRECTORY ends in a slash (see page 195). No begin necessary if the rescue is for the entire procedure.)

    2009-02-13
    203SUGGEST

    I believe the following text
    number:
    currency:
    format:
    unit: “$”
    precision: 2
    separator: “.”
    delimiter: “,”
    format: “%u%n”

    should not appear on page 203 but on page 205 as it already does

    2009-02-13
    250OK

    On the 3rd and on the 4th line “Be careful to use an explicit receiver when assigning to integration test attributes
    in an integration test” should be “Be careful to use an explicit receiver when assigning to them in an integration test”. Right?

    2009-02-13
    554OK

    suggest removing the sentence “…have a look at Rick Olson’s Acts as Attachment plugin.” and the footnote referencing technoweenie.stickipad.com
    I don’t know Olson but
    #) stikipad.com often unavailable
    #) Seems like Olson’s moved to github.com
    #) he says attachment_fu is the successor to the plugin mentioned. Suggest replacing with “There are several excellent plugins available for making handling attachments easier.” and let Google do the rest. thanks for listening!

    2009-02-13
    109OK

    First sentence of first paragraph needs to be revised. It is not very clear at first glance. It reads “By choosing something other than the cookie store, you do however have one more action you will need to take.” Why not simplify the wording to read “By choosing the cookie store you have one more action to take.”

    2009-02-13
    45TYPO

    Note 2, third sentence:
    However, if the Mogrel web
    should be Mongrel

    2009-02-13
    25OK

    At the very beginning of the book there’s an example that depicts routing + MVC flow. The example uses a link to an add_to_cart action and thus feels obligated to add a footnote about GET vs POST.

    I think it could be less convoluted to come up with an example which is just valid, no footnotes needed. /products/show/15 for example (I suggest /products/show instead of modern RESTful routes because as it happens with the current example it contains explicit elements.)

    With /products/show the same flow is kept, only it reads and does not write, but that’s fine.

    2009-02-13
    309OK

    You should explain or mention, what SKU means.

    2009-02-13
    362OK

    “divine” seems to a typo?

    2009-02-13
    167OK

    You might want to point out that you need to change the single quotes to double quotes when you modify the generated users_controller.rb to show the user name in the flash notice:
    flash[:notice] = “User #{@user.name} was successfully created.”

    Likewise for update

    Not sure how much Ruby you want to go into, but you might want to explain the difference between the two quotes

    2009-02-13
    43ERROR

    On p. 37 it says “once you
    create an application with a specific version of Rails, it will continue to use
    that version of Rails—even if newer versions are installed on the system—until
    you decide it is time to upgrade.”

    On p. 43 it says “The next
    time you start your application, it will pick up this latest version of Rails.”

    I’m not sure which is correct. If both are correct, I’m very confused.

    2009-02-13
    171OK

    I don’t see where views/layouts/admin.html.erb is created.
    I had to create it manually. Without it, the admin pages don’t get the stylesheets.

    It seems the layout file only gets created as part of a scaffold and not a controller. Its page 171 and I don’t think you have ever actually said what a scaffold is.

    (Sam says: addressed on page 177)

    2009-02-13
    163OK

    password= sets the instance variable @password BEFORE it checks that the new password is not blank. A subsequent call to the password read accessor would return blank even though the underlying hashed_password still had the old value.

    As an aside, I don’t like the password variable at all since it is holding the cleartext password. As far as I can work out, the read accessor is only there to keep the admin templates happy (f.password_field :password). The other use is within the write accessor which could just as easily use the pwd parameter. I'd be tempted to eliminate the password variable and have the read accessor always return blank. If there was a way to make f.password_field input only (which it should be anyway) then you could eliminate the password read accessor altogether.

    2009-02-13
    527TYPO

    In the second paragraph, I’m not sure if the first sentence makes sense:


    In
    addition to :all and :defaultsjavascript_include_tag accepts as parameter the value
    :defaults which acts as a shortcut, cause Rails to load the files prototype.js,
    effects.js, dragdrop.js, and controls.js, along with application.js if it exists.
    ———

    Is :defaultsjavascript_include_tag a single parameter? Should this be just :defaults? If so, then the next part of the sentence will need to be modified as well. I’m new to Rails, so if it is, then sorry for my mistake.

    2009-02-13
    76TYPO

    The command should be bold to follow the style of the other commands that we issue:

    ruby script/generate scaffold product \\
    title:string description:text image_url:string

    Right now the command looks like output.

    2009-02-24
    119ERROR

    The old version of the code that page 119 refers to (page 118, depot_h/app/controllers/store_controller.rb#add_product) had a
    def
    rescue
    else
    end

    block. The new code has no ‘else’ but the text on page 119 still refers to that “little-known feature of Ruby’s exception handling” the ‘else’ clause.

    2009-02-13
    211OK

    The strategy you chose for internationalizing content is unfortunate. In my case, I am dealing with hammers and thumbtacks and would really like to see a solution based on fourth normal form. Please!

    2009-02-13
    73OK

    “timeout: tells the SQLite3 database adapter” => should be MySQL database adapter.

    2009-02-13
    88OK

    I would change the error message in the code from ‘should be at least 0.01’ to ‘must be at least 0.01’ to be consistent with the other (built-in) Rails errors.

    2009-02-13
    388OK

    The third line from the top should read
    id = 2 instead of id = 1 (because we already used id 1 in the previous commands)

    This is correctly reflected in the listing of the select * from catalog_entries. That is the resource_is = 2.

    The comment below should also be updated to not say that they all have id 1. The alternative way to fix this typo is to get the listing for Article One to have a resource_id = 1

    2009-02-13
    70OK

    First para says “the commands you’ll need to create the database and grant permissions will be different.” But they’re not just different, the flow is nonexistent for SQLite3. Sounds like this text is left over from an old version where explicit database creation was always required.

    2009-02-13
    177SUGGEST

    “We start by removing the generated layouts.”. The word “start” suggests that there will be second step. But there isn’t?

    2009-02-13
    177OK

    “We start by removing the generated layouts….” : should the text mention to delete “line_items.html.erb” too?

    2009-02-13
    432TYPO

    Third paragraph, the phrase “to our cart” should be removed from the end of the last sentance. (Left over from an old example.)

    2009-02-13
    206TYPO

    Task I: Internationalization
    The div for email still includes the non-i18n’d string
    <%= form.label :email, “E-Mail:” %> should be
    <%= form.label :email, I18n.t(‘checkout.email’) + “:” %> now.

    2009-02-13
    127OK

    I’m confused why views/store/add_to_cart.html.erb is referred to as a “template” and not a “view”. Aren’t templates in the templates directory?

    2009-02-13
    127OK

    Never mind that last erratum. I had mixed up “template” with “layout”.

    2009-02-13
    268TYPO

    “The latest drive for RESTful interfaces was been
    similarly available for months ahead of the 2.0 release.”

    “was been”??

    2009-02-13
    256TYPO

    Third paragraph:

    “unubtrusive” should be “unobtrusive”

    2009-02-13
    52OK

    Missing link for erb/ex2.html.erb would be helpful. Also note that the published source for ex2.html.erb on the web site contains extra commented code.

    2009-02-13
    302OK

    “Also be aware that renaming is not supported by all the adapters.”

    Can you list which ones do and which ones don’t?

    2009-02-13
    263TYPO

    “Rails provides a rake test to tell you…”

    I think that should be “task”.

    2009-02-13
    538TYPO

    Towards the bottom of the page I think the following line;
    select_datetime(date = Time.now, options)

    should read;
    select_datetime(time = Time.now, options)

    2009-02-13
    671ERROR

    `ruby script/plugin install exception_notification` installs outdated version of plugin which doesn’t work with RoR 2.2.2. `ruby script/plugin install git://github.com/rails/exception_notification.git` works fine

    2009-02-13
    72SUGGEST

    It might be helpful to note that for sqlite, the “database” parameter is the file used, and the path starts at the rails root.

    2009-02-13
    77OK

    In the last paragraph, it implies that rake can only create the database for you if you are using SQLite3. This isn’t the first time it has been suggested - but considering using “root/” on MySQL is alluded to as being the “going with the flow” method for using MySQL, using rake to create the database is common in this circumstance.

    2009-02-13
    95SUGGEST

    “Add the product price to the output of the index action” is listed as a “PlayTime” activity, but it’s already done on page 82.

    2009-02-13
    99TYPO

    Footnote at the bottom should probably read “Protecting Your Application from XSS…”

    2009-02-24
    253OK

    Why specify an id at all in the yaml? Won’t it pick a unique one for us? Then we could use 1000.times.

    2009-02-13
    258ERROR

    In the footnote: Flex Mock docs have moved to flexmock.rubyforge.org

    2009-02-13
    264ERROR

    The docs.rubyrake.org link takes me to some guy’s blog. Remove the “docs.” and it seems to be more what I was looking for.

    2009-02-13
    175OK

    In “A Friendlier Login System” in the login method you have the line session[:user_id] = nil that appeared from nowhere. It wasn’t included in the login code on p. 170.

    2009-02-13
    176OK

    I had to put layout “store” in the admin controller to get it to work. Putting it in application.rb had no effect. In fact, I could put layout “bogus” in application.rb and it didn’t raise an error. Using InstantRails upgraded to Rails 2.2.2.

    (Sam says: Do you happen to have a file named app/views/layouts/admin.html.erb? If so, remove it.)

    2009-02-13
    115OK

    It might be helpful to the reader to have some direction as to how to build the ActiveRecord based cart. Perhaps a footnote link to a tutorial.

    2009-02-13
    670OK

    Running tcsh, I had to put quotes around the Ruby code in the script/runner command:

    ./script/runner ‘CGI::Session::ActiveRecordStore::Session.delete_all([“updated_at < ?”, 12.hours.ago])’

    Otherwise I got a shell parse error:
    Badly placed ()’s.

    2009-02-13
    671TYPO

    Third line: should “method” really be in a special font?

    2009-02-13
    634TYPO

    s/therfore/therefore/

    2009-02-13
    215OK

    There is no db/production.sqlite3. We created only a development DB on p. 73.

    (Dave says: the book says there’s a configuration entry for it. It would get created automatically should you ever try to use it)

    2009-02-24
    88ERROR

    “Note that before we compare the price to 0.01, we first check to see whether it’s nil. This is important: if the user leaves the price field blank, no price will be passed from the browser to our application, and the price variable won’t be set. If we tried to compare this nil value with a number, we’d get an error.”

    That would be true, except that you’re already testing for numericality. If you leave the field blank, the form errors on the ‘not a number’ validation.

    2009-10-22But it won't stop there. With this check in place, two error messages are produced. Without this check, a stack traceback is produced in development mode, and a "we're sorry" message shows up in production.
    175SUGGEST

    the box “A Friendlier Login System” is inserted in the middle of depot_q/app/controllers/store_controller.rb code listing from the previous page.
    Leaving a lonely “end” line code to appear on the first line just after the box.
    The “end” command looks like an error or at least and out of context.

    2009-02-24
    101SUGGEST

    On page 101, you tell the reader to download depot.css. We already did this, back on page 90. Or is depot_e different from depot_c? Ah. Perhaps you should mention that.

    2009-02-24
    388OK

    resource_id for “Article One”:
    Reads: resource_id = 2
    Should : resource_id = 1

    2009-10-17I can't reproduce this problem
    76SUGGEST

    backslash in “script/generate scaffold” line after “product” is confusing for new users - this might also be a good place to show for new users the “script/destroy scaffold” command

    2009-02-24
    183OK

    spam∧H∧H∧H∧Hmailing system;

    (Dave says: it’s a JOKE!!!)

    2009-02-13
    105OK

    number_to_currency(1234567890.50, :unit => “£” ,
    :separator => “,” , :delimiter => “” )
    -> £1234567890,50

    the example should show a £ instead of the word pound like the example above this

    (Dave says: the output will be £ The browser may replace this with a pound sign.)

    2009-02-24
    131TYPO

    In highlighting the newly-added line return_to_index in the store_controller.rb code, the line is incorrectly indented. It should line up with the lines above it.

    2009-02-24
    358TYPO

    The user.changes should have a cap “D” in this code to match what was found and in other lines. {“name”=>[“dave”, “Dave Thomas”]}

    2009-02-24
    CodeERROR

    Error in source code given in the zip file. (Source code does not appear in the book)
    in restful2\\app\\views\\comments\\edit.html.erb
    line
    <%= link_to ‘Back’, article_path %>
    should read
    <%= link_to ‘Back’, article_path(@article) %>

    2009-02-24
    45OK

    Under Mongrel, there doesn’t appear to be anything logged when running the newly created app. My guess is Mongrel doesn’t log access to static resources by default?

    (Dave says: logging is certainly different under Mongrel)

    2009-02-24
    212SUGGEST

    Missing the web link to you site where play time exercises are discussed.

    2009-02-24
    634TYPO

    s/therfore/therefore/

    2009-02-24
    635TYPO

    Third paragraph: s/Parameters values/Parameter values/

    2009-02-24
    19TYPO

    And in some cases involving modification of an existing file where the
    lines to be changed are may not be immediately obvious,

    2009-02-24
    73TYPO

    pool: tells Rails how many conconcurrent connections your …

    too many con’s, not enough pros

    2009-02-24
    573OK

    The code supplied for pragforms is still incorrect in that when used, the following error is seen:
    pragforms/config/boot.rb:33:Warning: Gem::SourceIndex#search support for String patterns is deprecated
    rake aborted!
    undefined method `require_gem’ for main:Object
    Rails is 2.2.2 and gem is 1.3.1
    The work around to ’rails pragforms and then copy the appropriate code to the correct folders.
    Not very friendly though!!

    2009-10-22I can't reproduce this problem.
    133TYPO

    In the store_controller.rb code, I’m not sure why the respond_to block is indented so that it looks as if it belongs to the add_product method.

    2009-02-24
    135OK

    The link in footnote 3 is giving me a 404.

    (Dave says: just checked it)

    2009-02-24
    254OK

    The book text is missing DAVES_DETAILS hash.
    It appears only on the sample code to download.

    (Dave says: If you need it, it’s in the code listings in the appendix (on page 247 of B1.10). We decided not to use up space with it here)

    2009-02-24
    275OK

    Context: “You can get more information by typing ri Logger at a command prompt” (Last paragraph)

    Running Ubuntu, so that may be the problem, but When I try that I get

    The program ‘ri’ is currently not installed. You can install it by typing:
    sudo apt-get install ri

    (Dave says: bad packaing on the part of Ubuntu: ri is part of Ruby, and shouldn’t be split out the way they did)

    2009-02-24
    338DEFER

    Context: “If you use the :joins or :select options, objects will automatically be marked :readonly.”

    But I can do this:

    kirk$ script/console
    Loading development environment (Rails 2.1.0)
    >> elt = Project.find(:first, :select => “id, name”)
    => #<Project id: 1, name: “P1”>
    >> elt.name=“P01”
    => “P01”
    >> elt.save
    => true
    >> elt
    => #<Project id: 1, name: “P01”, updated_at: “2009-02-18 18:25:00”>
    >> quit
    kirk$ sqlite3 db/development.sqlite3 “select * from projects”
    1|P01|1|2009-02-11 17:32:43|2009-02-18 18:25:00

    which implies that using the :select option does not necessarily make the object read only.

    Granted, I could be missing something here.

    2009-10-26
    359OK

    Context: “user.name = ‘Bill’
    user.name_change # => [‘Dave’, ‘Dave Thomas’]”

    This implies that the attribute change is only tracked the first time it is updated.

    However, when I do this

    kirk$ script/console
    Loading development environment (Rails 2.1.0)
    >> elt = Project.find(:first)
    => #<Project id: 1, name: “P01”, organization_id: 1, created_at: “2009-02-11 17:32:43”, updated_at: “2009-02-18 18:25:00”>
    >> elt.name = ‘P1’
    => “P1”
    >> elt.name_change
    => [“P01”, “P1”]
    >> elt.name = “P_1”
    => “P_1”
    >> elt.name_change
    => [“P01”, “P_1”]

    it looks as if the attribute change is tracked each time you assign a new value to the attribute (although intermediate changes are lost).

    2009-10-17I can't reproduce this problem.
    373TYPO

    Context: "acts in many

    ways like has_many.habtm creates an attribute that is essentially a collection."

    I think there should be more whitespace between the two sentences.

    2009-02-24
    421TYPO

    near the top of the page “it constructs an
    SQL select statement.” I believe this should be “a SQL select…”

    2009-02-24
    226OK

    This section (14.3) kind of disappointed me. It looks a bit out of the context for this part of the book. It is quite a lengthy reference of what assertions, selector or whatever is available in rails but that’s not the place to put it. This part of the book is about the depot application and the content should focus on how to apply all this to the depot application itself. Reference-style listings should either go the appendix or removed. I can find these if I want to in the rails reference.
    Thanks

    2009-02-24
    283TYPO

    “provides a ActiveSupport::Multibyte::Chars”->
    “provides an ActiveSupport::Multibyte::Chars”

    2009-02-24
    482TYPO

    top paragraph mispelling
    “attemps”

    2009-02-24
    35OK

    first command on the page has an error:

    “sudo port upgrade sqlite3” —> “sudo port update sqlite3”

    2009-02-24
    290ERROR

    The name.chars.length gives an error:
    undefined method `length’ for #

    The correct class name for multibyte characters support is mb_chars.

    2009-10-17
    149SUGGEST

    Not sure if this is unclear or an error…

    The second to last paragraph says that the :url parameter in the form example generates an HTTP POST request. However, there’s nothing in the :url fields that indicates it’s a POST method.

    So should there be extra fields for “:method => :post” in the sample code, or is POST the default method for form_for in Rails? If the latter, that should be stated explicitly.

    (Dave says: POST is the default for all browser forms)

    2009-02-24
    162ERROR

    “We’ll create a salt string by concatenating a random number and the object
    id of the user object. It doesn’t much matter what the salt is as long as it’s
    unpredictable (using the time as a salt, for example, has lower entropy than
    a random string). We store this new salt into the model object’s salt attribute.
    Again, this is a private method, so place it after the private keyword in the
    source. ”

    The source code for that particular method should be:

    class << self
    private
    def encrypted_password(password, salt)
    string_to_hash = password + “wibble” + salt
    Digest::SHA1.hexdigest(string_to_hash)
    end
    end

    in order for it to be a private class method. The given method in the source code still allows encrypted_password to be called publicly.

    2009-10-22I'd prefer to leave the text as is.
    141SUGGEST

    Arrgh the comment above referring to the code on page 141 (it’s 142 in my B1.10 version):

    “the code on page 141: —- format.js if request.xhr? format.html{ redirect_to_index } —- seems like the second line will be called in both js and html variants - what is a logical error in this case (Sam says: Both statements simply define what formats will be accepted)”

    respond_to do |format|
    format.js if request.xhr?
    format.html {redirect_to_index}
    end

    — Sam, in the “Sam says:” parenthetic comment above is B O G U S. How about an explanation as to why the code isn’t:

    respond_to do |format|
    if request.xhr?
    format.js
    else
    format.html {redirect_to_index}
    end

    like I was expecting (and I suspect other readers will suspect as well. Your " (Sam says: Both statements simply define what formats will be accepted)" is a stark contrast to the rest of the book where you folks do a good job of explaining the material. How about some text in the book? If it is indeed “simply defining what formats will be accepted”, why is the if statement needed at all?

    2009-10-22In Ruby, this: \n \nrespond_to do |format| \n format.js if request.xhr? \n format.html {redirect_to_index} \nend \n \nIs equivalent to this: \n \nrespond_to do |format| \n if request.xhr? \n format.js \n format.html {redirect_to_index} \n else \n format.html {redirect_to_index} \n end \nend \n \nThe intent here is to define js as a valid response type, but *only* for xhr requests. Does that help?
    375TYPO

    superfluous ‘a’ before the word ‘normal’ in the following passage of the second paragraph on p. 375 of the PDF:

    “In such a case, one would instead use a regular Active
    Record models as join tables”

    2009-02-24
    118TYPO

    Page 118 shows the code for add_to_cart and shows the rescue clause. But page 119 refers to an else clause which is clearly not there. The 2nd edition of the book has this correct:

    def add_to_cart
    begin
    product = Product.find(params[:id])
    rescue ActiveRecord::RecordNotFound
    logger.error(“Attempt to access invalid product #{params[:id]}” )
    flash[:notice] = “Invalid product”
    redirect_to :action => :index
    else
    cart = find_cart cart.add_product(product)
    end
    end

    2009-02-24
    73TYPO

    The first paragraph on this page has an unnecessary apostrophe+s after the first word which is “There”. It currently reads:
    “There’s are a few additional parameters that may or may not appear in your
    default database.yml file.” but should read:
    “There are a few additional parameters that may or may not appear in your
    default database.yml file.”

    2009-10-16
    668TYPO

    Last paragraph before section 28.5: “version of it is checkout out onto the server” should be “is checked out onto”

    2009-10-17
    89SUGGEST

    Creating a test data migration really deserves a section of its own rather than being included in “Prettier Listings”

    Mark.

    2009-10-17This will be converted using the new seeds.rb function in the next edition and the chapters will be reorganized.
    172DEFER

    Figure 11.1 shows code in the controller that doesn’t exist: it shows name = params[:name] but the controller actually uses user = User.authenticate(params[:name], params[:password]) — concept still comes across, though.

    2009-10-26
    395SUGGEST

    Why the blank page?

    2009-10-17
    109TYPO

    The first paragraph has incorrect spelling for “choosing” which appears as “chosing”

    2009-10-17
    35DEFER

    Before the MacPorts package can be installed, the Xcode developer tools must be installed.

    Pages 8-10 of the Mac OS X Leopard Portable Genius provides instructions for finding and installing the Xcode tools. The authors should either point readers to that source, another good source or provide similar instructions.

    2009-10-26Will look to expand the instructions in the next edition.
    104DEFER

    Figure 7.3 shows “Add to Cart” button rendering next to the price but for me it renders below the price (Rails 2.2.2 on Safari & Firefox)
    Could not figure out how to get it to render as displayed (which would be desirable)

    2009-10-26
    91OK

    I’m currently using the PDF version of the book to Copy & Paste the code into TextMate adn work with it. This is often in off-line conditions, so downloading from PragProg is no option.

    Suggestions:
    1 - please remove the line numbers/dashes, or reformat the PDF in such a way that the clear code can met Copied;
    2 - do not place references directly next to the code, as on PDF-page 110, (or again, do it in such a way that the clear code can met Copied);
    3 - include spaces in the code so the code formatting is maintained while Copying.

    Thanks & Keep up the Good Work!

    Rogier Hof

    2009-04-07If we did that'd we'd then get people saying "how can I know where line 17 is: please put numbers on..." \n \nMy suggestion: download the whole tarball once: then you'll have all the code available to you offline. \n \n \nRegards \n \n \nDave
    45OK

    when I write:
    > ruby script/server
    (on mac osx with rails 2.2.2)
    It boots Mongrel, not WEBrick.

    2009-10-16Per the footnote, Mongrel will be used if it is available.
    109DEFER

    I received a message when adding to cart that my key did not match. I tried restarting the server. However, the solution that worked was for me to delete my session cookie (it must have had some older bad info in it).

    2009-10-26
    115SUGGEST

    I can’t figure out from the text how the application decides to store application data (cart and cart_item) in the session? Does attr_reader specify this? Or is it because we didn’t specify to use a database (by inheriting the activerecord class) for this model?

    2009-10-22Look at the find_cart method of the store_controller (page 109).
    452TYPO

    “to our applications routes.”->“to our application’s routes.”

    2009-10-17
    548DEFER

    I guess there should be a
    <%= submit_tab %>
    expression between the “text_field_tag(:arg2… ” line and “<% end %>” line. Otherwise it just can’t work.
    And further, though the source code of the “without error checking” version is not included, I guess
    params[:arg2]
    should be
    Float(params[:arg2])
    , or an error saying “can’t convert string to float” or something will occur.

    2009-10-26
    555TYPO

    At the end of the page:

    “Unlike our previous approach, it handles storing the uploads in both your filesystem or a database table”

    This should be
    1.“…both your filesystem and database tables.”
    or
    2.“…either your filesystem or a database table.”
    (2. is better, perhaps).
    I.e., “either..or” or “both..and”, but not “both..or”.

    2009-10-17
    773TYPO

    In the index under XML, it says: “template, see Template, rxml”

    Under Template on page 769, there is no listing for rxml because of course that was deprecated in Rails 2. It should suggest “Template, xml.builder”.

    2009-10-17
    253DEFER

    The class OrderSpeedTest has a line at the top: “tests StoreController” The generator seems to put those lines in test classes too. What is this for? I searched the book for “tests” and I don’t see anyplace where you explain what this line is for or what it does.

    2009-10-26
    469TYPO

    “format, which is the value of the accepts MIME type for the request.
    the MIME type for the format used in the request…”
    ->
    “format, the MIME type for the format used in the request.”

    2009-10-17
    513SUGGEST

    Loved that big sign!

    2009-04-21
    410TYPO

    under validates_presence_of,

    Options:
    :allow_blank … if true, nil attributes are considered valid

    looks like a cut and paste error from :allow_nil line above it. Should be blank attributes are considered valid

    2009-10-17
    112OK

    Right before the first code example:
    “(we’ll tart it up in a minute)”

    2009-04-21To "tart up" is to make pretty cosmetically.
    312TYPO

    In first, and only, sentence of first paragraph: “…a specific database engine: and SQL….” Is the colon after engine perhaps supposed to be a semi-colon?

    2009-10-17
    314DEFER

    Link in footnote 4 goes to a “This topic does not exist yet” page.

    2009-10-26
    88ERROR

    First line: “New actions must go before the protected line.” We’re working in a model, so methods wouldn’t be considered actions, would they?

    2009-10-22
    120TYPO

    Missing the arrows in the code sample to show the lines of code that have been added to store.html.erb.

    2009-10-22
    110DEFER

    “Observant readers (yes, that’s all of you) will have noticed that our catalog listing view already includes an Add to Cart button for each product.” Wait. This is never mentioned before. index.html.erb is only discussed later in this page. Am I missing a page here?

    2009-10-26
    109TYPO

    It is not clear here if store_controller.rb should be edited directly or created with script/generate controller store, because that’s how controller.rb’s were created up to this point.

    2009-10-22edited directly.
    140OK

    My code gives me an error if I simply run “redirect_to_index”. I have to pass in a parameter, the error message tells me that I have to pass in a parameter. So I use “redirect_to_index(nil)” instead.

    2009-10-26I can't reproduce.
    251TYPO

    The sentence that states the CRUD helper methods is written as “[…], PUT, or DELETE XML_HTTP request […]”. This should be written as “[…], PUT, DELETE, or XML_HTTP request […]”.

    2009-10-17Correct as is: it performs one of those five types of XHRs.
    358TYPO

    The last word of the second to last paragraph should be “comprehensible” instead of “comprensible”.

    2009-10-17
    509TYPO

    A server should not provide a dates more…
    ^
    date

    2009-10-17
    31TYPO

    The book states that “because InstantRails 2.0 is a single download that contains Ruby, Rails, SQLite 3 (version 3.5.4 at
    the time of writing), and all the gubbins needed to make them work together.”

    True, but a bit confusing IMHO. Instant Rails 2.0 also bundles MySql, and doesn’t advertise its bundling of sqllite on their site. I was taken aback when installing it

    2009-10-16My sense is that pointing out that InstantRails 2.0 highlights MySQL would only add to the confusion.
    119DEFER

    You could add a footnote onto the last sentence of this page (which is “This time, when we manually enter the invalid product code, we see the error
    reported at the top of the catalog page.
    ”), something like:
    “You may need to refresh your browser’s view of the store page in order to see the formatting for the error message.”

    2009-10-26
    234DEFER

    It looks like “follow_redirect” was taken out from functional tests. I came across the following paragraph in the “lib/ruby/gems/1.8/gems/actionpack-2.2.2/CHANGELOG” file after running into a method_missing error during the test.

    208
    209 * Remove follow_redirect from controller functional tests.
    210
    211 If you want to follow redirects you can use integration tests. The functional test
    212 version was only useful if you were using redirect_to :id=>…
    213

    Thanks.
    —IJ

    2009-10-26
    173SUGGEST

    Perhaps this is intentional, but the code listings use parentheses and quotes inconsistently. For example, in the authorize method on this page you use redirect_to(:controller => “admin”, :action => “login”). On the previous page, the same line omits the parentheses and switches the double quotes to single.

    2009-10-17
    721ERROR

    The listing in the book for the depot.css file (p. 721) does not appear to include the logic to alternate shading when displaying the Listing Products page as shown on page 94. I cut and pasted the .css file instead of downloading it.

    So far, though, excellent update. Many thanks.

    2009-10-17
    108SUGGEST

    After updating application.rb to complete the setup for using cookies, the next section ‘Carts and Sessions’ does not guide the user back to the store_controller.rb file. As previous examples tell the user which file to update, omitting this detail suggests to the reader that application.rb is being updated with find_cart, which may be counterintuitive to an experienced coder, but confusing for a newbie. I’m a newbie, so I had to dig through the example code to find out where the find_cart method went, and once I did, it was obvious why - but not until.

    Just my $0.02. Otherwise, so far so good. Many thanks.

    2009-10-17This is indicated on the very next page... top of page 109.
    632TYPO

    apparent inconsistency in URLS in paragraph starting with “The way the magic works…” - difference is localhost:3000 vs. rubymac:3000

    2009-10-17
    634TYPO

    In third bullet point on the page, last sentence reads “They method names determine the underlying…” should probably read “The method names…”

    2009-10-17
    227TYPO

    The sample code

    <% SALT = “NaCl” unless defined?(SALT) %>
    dave:
    name: dave
    salt: <%= SALT %>
    hashed_password: <%= User.encrypted_password(‘secret’ , SALT) %>

    should be

    <% SALT = “NaCl” unless defined?(SALT) %>
    dave:
    ID: 1
    name: dave
    salt: <%= SALT %>
    hashed_password: <%= User.encrypted_password(‘secret’ , SALT) %>

    For MYSQL.

    2009-10-17ID is optional in fixtures, starting with Rails 2.0
    236TYPO

    At the top and middle of the page:
    p#some-id should be
    p.some-id

    2009-10-17ID selectors start with a #: http://www.w3.org/TR/CSS2/selector.html#id-selectors
    358TYPO

    First sentence of page:
    Active Record comes the rescue here. Missing “to” the rescue.

    2009-10-17
    107ERROR

    In the recent rais release the default seems to be using a database, so this paragraph is not up to date (i think).

    2009-10-17Looking in the config/initializers/session_store.rb as generated by Rails 2.3.4, it still indicates that the default is cookie-based, and that uncommenting out the assignment to ActionController::Base.session_store is required in order to get a database based session store.
    652TYPO

    “As agile developers know, the more feed-back users can give we early in the development process, the better.”

    Misplaced “we”

    2009-10-17
    658TYPO

    “If we have multiple developers collaborating on development, we might feel uncomfortable putting the details of the configuration our database …”

    “of our database?”

    2009-10-17
    660TYPO

    “The other updates the file database.yml from the copy that we previously placed on the sever.”

    server, not sever.

    2009-10-17
    661TYPO

    “As before, we might need to uncomment out and adjust the default_environment.”

    The phrase “uncomment out” doesn’t make sense.

    2009-10-17Uncomment out means to remove the comment delimiter.
    108ERROR

    I’m running Rails 2.3.2. After uncommenting “ActionController::Base.session_store = :active_record_store” in session_store.rb, I started getting “ActionController::InvalidAuthenticityToken” error messages (as mentioned by another poster). Adding “protect_from_forgery :only => [:create, :update, :destroy]” to store_controller.rb and products_controller.rb eliminated the InvalidAuthenticityToken error when adding a product to the cart, but did not eliminate the error when creating or updating a product.

    2009-10-17refreshing or clearing your cookies will eliminate the error -- the protect_from_forgery line is not needed.
    113TYPO

    You’re missing a 3rd ‘end’ on your cart.rb

    2009-10-22We are just showing the one method here.
    40OK

    In the footnote (footnote 5), “gem server” should be “gem_server”.

    2009-04-21"gem server: is the preferred form
    108DEFER

    The InvalidAuthenticityToken error messages mentioned by others can be avoided if the developer clears his/her cookies.

    2009-10-26
    70TYPO

    The fourth paragraph on this page ends “If this applies to you, simply skip ahead to Section 6.1, Configuring the Application”. But we are already in section 6.1, and the unnumbered heading “Configuring the Application” is only a few lines further down. The reader just needs to skip the database creation step about to be described, picking up again from “Configuring the Application”.

    2009-11-03
    74DEFER

    Sadly it appears that the recent rework of the Rails wiki has removed the page (Mysql+Connection+Problems) referred to in the footnote.

    2009-10-26
    76DEFER

    Footnote 5 says “Windows users will need to put the entire command on one line, without the backslash.” The caret (‘^’) character can be used as a continuation character on the Windows command line.

    2009-10-22Fixed in edition 4.
    99SUGGEST

    The downloadable store.html.erb layout contains some “technical” HTML commnents, e.g.

    Also, we saw the scaffold-generated template for products earlier, and that just used “yield” without the :layout parameter. Should you explain the difference?

    2009-10-17The comments are a part of the build process -- and important to the way we ensure that the code in the book is always working. I hope they don't cause any problems. \n \nThe :layout parameter is ignored and essentially obsolete at this point, and will be removed entirely from the next edition.
    102SUGGEST

    When introducing the number_to_currency helper for price display, it would be prudent to escape the result.

    2009-10-22Currency values are html safe, and we use the ability to introduce markup in the I18N chapter.
    108SUGGEST

    For Rails 2.3, the configuration of the :session_key and :secret described at the top of this page have (like the choice of session store covered on the previous page) moved to config/initializers/session_store.rb

    2009-10-17See http://www.pragprog.com/wikis/wiki/ChangesInRails23
    112DEFER

    For CartItem, it would be good to explain in the text that the file name should be cart_item.rb. At present the reader has to look at the Download link to see this.

    2009-10-26
    120OK

    " She notices a minor problem on our new cart display—there’s no way to empty items out of a cart."

    There’s a deficiency she must have noticed before this - there’s no ‘Continue shopping’ link!

    2009-04-21
    122SUGGEST

    In the new stylesheet fragment, the comment

    /* Styles for the cart in the main page */

    is premature! The cart has its own page at present.

    2009-10-22Main as in div="main". Contrast with div="side" (next chapter).
    138SUGGEST

    Third paragraph, introducing the helper ‘hidden_div_if’ - the last sentence,

    “We’d use it in the store layout like this:”

    reads as if we aren’t actually making that change yet… but in fact we need to. It would be clearer to say “Use it in the store layout like this:”

    2009-10-22
    147SUGGEST

    The use of

    2009-10-22
    159SUGGEST

    Bottom of the page: “Since this modified config/routes.rb, which is cached for per formance reasons, you will need to restart your server.” - It would have been nice to know this earlier.

    2009-10-22Earlier than what? This appears at exactly the point of the change.
    167ERROR

    In the revised new.html.erb,
    <%= f.label :user_password, ‘Password’ %>
    should be
    <%= f.label :password, ‘Password’ %>
    and
    <%= f.label :user_password_confirmation, ‘Confirm’ %>
    should be
    <%= f.label :password_confirmation, ‘Confirm’ %>

    2009-10-22
    275TYPO

    Line 4 of the code example states:
    Rating = Struct.new(…)
    of course it should be
    rating = Struct.new(…)

    (lowercase r)

    2009-10-17The intent is to define a class whose name is a constant, so upper case is quite appropriate here.
    275TYPO

    Color of the text commented out at the botton of code listing should appear in green, not blue.

    2009-11-03
    169DEFER

    “With postback handling, there is no need to issue a redirect and therefore
    no need to make flash available across requests. flash.now makes the notice
    available to the template without storing it in the session.” - The use of flash.now is because we are returning the user to the submitted screen (as we would with a validation failure). A successful POST to a postback handler still needs to redirect (and does, in the code given here).

    2009-10-26
    279TYPO

    puts count.inspect #=> {" “=>3, ”w“=>1, ”m“=>1, ”N“=>1, ”o“=>1, ”e" =>2, “h” =>1, “s” =>1, “t” =>2, “i” =>2}
    -> half of this is in blue, when the whole of it should be in green

    2009-11-03
    171ERROR

    We haven’t got a layout for the admin controller.

    2009-10-22Not...yet. This will be addressed in a few pages.
    176OK

    This looks like a problem with Rails 2.3.2 (Mac OS X, Leopard, updated as described in the book).:

    Following along, I deleted my admin user and tried to use script/console to create a new one.

    $ ruby script/console
    Loading development environment (Rails 2.3.2)
    >> User.create(:name => ‘Justin’, :password => ‘frog’,
    ?> :password_confirmation => ‘frog’)
    NameError: uninitialized constant User::Digest
    \tfrom /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in `const_missing’
    \tfrom /Users/justin/projects/depot/app/models/user.rb:38:in `encrypted_password’

    Providing the relevant ‘require’ got me going again:
    >> require ‘digest/sha1’
    => []
    >> User.create(:name => ‘Justin’, :password => ‘frog’,
    ?> :password_confirmation => ‘frog’)
    => #<User id: 3, name: “Justin”, hashed_password: “3d6f12596eff95c7ce65303c3376302af471e5c8”, salt: “126957100.737268448867861”, created_at: “2009-03-27 17:01:32”, updated_at: “2009-03-27 17:01:32”>

    2009-10-17I can't reproduce. Please verify that require 'digest/sha1' is the first line in app/models/user.rb
    177SUGGEST

    The code for the destroy method reads better, and is more consistent with other methods, if you put the success message in the flash after deleting the User.

    2009-10-17
    287SUGGEST

    name.chars.reverse —-> shouldn’t this read name.mb_chars.reverse instead?

    2009-10-17
    189DEFER

    In who_bought.atom.builder:
    i) The feed.updated timestamp should really be taken from the latest order, not the first in the list
    ii) the total line in the table in the summary should use xml.td rather than xml.th
    iii) The sample output (spanning pages 189 and 190) appears out of date: it doesn’t include the summary table.

    2009-10-26
    201TYPO

    In the en.yml listing, the layout: element is missing.

    2009-10-17
    206ERROR

    With Rails 2.3.2 the ActiveRecord error messages appear to be being escaped before being displayed - so the Spanish error messages for an empty checkout form include:

    - Forma de pago no est&aacute; incluido en la lista
    - Direcci&oacute;n no puede quedar en blanco
    (Checked with downloaded depot_s code, with the version number changed in config/environment.rb, controllers/application.rb renamed to controllers/application_controller.rb, and my existing database file copied over)

    2009-10-17Noted on http://pragprog.wikidot.com/changes-in-rails-2-3, and bug 2409 reported. Thanks!
    155ERROR

    Figure 10.3: validation errors - with Rails 2.3.2 and the provided styles both the labels and the form input controls are solid red. (Checked against full depot_s downloaded code.)

    2009-10-22
    207DEFER

    “Now we have the website itself translated, what’s left is the content.” - for completeness, it would be good to include translation of the payment drop-down menu items.

    2009-10-26
    317TYPO

    The arrow in front of t.string :pay_type, :limit => 10 usually indicates a change and is therefore unnecessary here.

    2009-10-17
    ?ERROR

    When showing the regular expressions on validating, they are being misformatted in the mobipocket version.

    Instead of showing as %r{(\\.(gif|jpg|png)$}i They show as:

    %
    \\.(gif|jpg|png)$}i

    2009-11-03
    356TYPO

    The code reads:
    user.name = ‘Bill’
    user.name_change # => [‘Dave’, ‘Dave Thomas’]
    This makes no sense, is it a typo?

    2009-10-17
    88DEFER

    The current code routines 2 errors if you leave Price blank.
    I suggest changing the validation for Price > 0 to the following:

    def price_must_be_at_least_a_cent
    errors.add(…) if !price.nil? && price < 0.01
    end

    2009-10-26
    241DEFER

    “Let’s launch straight in and implement the test of our story.” - for the reader following along in an editor, it would be nice to know the name of the test! This isn’t revealed until the complete code listing on page 243.

    2009-10-26
    60OK

    Second paragraph, " (In Rails, we call methods that make it easier
    to write templates helpers.)“—-”templates" should be singular or plural possessive (templates’)…
    You should add an erratum type for “copy edit” ;-)

    2009-07-08Dave says: Actually i is correct as it stands—templates is simply plural. Its like "We call people who look after animals zookeepers"
    435OK

    :month => /[01]?\\d/, should read :month => /[0-1]?\\d/,

    2009-04-21[01] means one of 0 or 1
    417TYPO

    The cubit ratio is right but handled wrong.
    read_attribute(“length” ) * CUBITS_TO_INCHES… doesn’t make sense with a ration of 18, as clearly an inche is smaller than a cubit. So if the data is stored in cubits, we should divide, not multiply, by the ratio in order to get the inches value.

    2009-10-17Since an inch is smaller than a cubit, you would expect any given measurement to take *more* inches than cubits. Example: 1 yard is 2 cubits is 36 inches.
    438DEFER

    Two paragraphs contradicting each other:
    :overwrite_params: “The options in hash are used to create the URL, but no default values are taken from the current request.”

    But above it states “:overwrite_params
    option to tell url_for that the original request parameters contained the new year that we want to use. Because it thinks that the year hasn’t changed, it continues
    to use the rest of the defaults.”

    ‘continue to use the rest of the defaults’ != ‘no default values are taken from the current request’

    2009-10-26
    270SUGGEST

    “Rails assumes that controllers in subdirectories of the directory app/controllers are in Ruby modules named after the subdirectory.”

    This is confusing. The controllers are modules? Only the ones in subdirectory? If so, how can they work since modules cannot be instantiated?

    2009-10-22Controllers are classes that are in modules. The example shows a BookController in the admin module.
    65SUGGEST

    The following line “timeout: tells the SQLite 3 database adapter how long you are willing to wait …” specifically refers to ‘SQLite 3’. This section is discussing using a different database from the default SQLite database so perhaps this specific reference to SQLIte 3 should be removed?

    2009-10-16Each adapter has different options, and this is an option supported by the SQLite 3 database adapter.
    7567TYPO

    The line “Weapply these migrations to update our database …” needs a space between ‘We’ and ‘apply’.

    2009-10-16
    488TYPO

    Last line: are passed the controller… it should read “are passed TO the controller”

    2009-10-17These methods will be passed the controller object as the first argument.
    634TYPO

    4th paragraph in SOAP section says, “…proven to be too attractive, therfore most SOAP based web services are defined …”

    “therfore” should be “therefore”

    2009-10-17
    520TYPO

    “In addition to :all and :defaults, javascript_include_tag accepts as a parameter the value :defaults”

    :defaults is repeated here

    2009-10-17
    217DEFER

    For those who are following along with the book, not the sample code, it would be helpful to specify where to put the “fixtures :products” line.

    It should read like this:

    require ‘test_helper’
    class ProductTest < ActiveSupport::TestCase
    fixtures :products
    #…

    Thanks! Great book!

    2009-10-26
    582DEFER

    The footnote at the bottom of the page just reiterates what the text says - the footnote can be safely removed.

    2009-10-17Fixed in the next edition.
    613TYPO

    The text says: “template. We have to give render the explicit
    path to the template (the leading ./) because we’re not invoking the view from a real controller and Rails can’t guess the default location.”

    … however the code shows none of that. There is no leading ./

    2009-10-17
    621DEFER

    Absolutely every single link to the Rails wiki is dead, including the one including in that page’s footnote.

    2009-10-26Yup—they've gone and totally reorganized the wiki (and deleted lots of useful content in the process. We're trying to work out what to do)
    628TYPO

    should say ‘real life’ not ‘real live’

    2009-10-17
    661TYPO

    The deployment section needs clean up - for example on this page you refer to the ‘mongrel’ instances … when the whole 10 previous page take you through setting up phusion.

    2009-10-17
    727DEFER

    dev.rubyonrails… is no longer valid

    2009-10-26
    216OK

    This is not an error so much as a question. I’m using mySQL and instead of getting 0 errors I get ActiveRecord::StatementInvalid: Mysql::Error: Column ‘quantity’ cannot be null: INSERT INTO ‘line_items’ (`updated_at`, `order_id`, `total_price`, `quantity`, `product_id`, `id`, `created_at`) VALUES (‘2009-04-07 16:40:04’, 1, 9.99, NULL, 1, 996332877, ‘2009-04-07 16:40:04’)

    2009-10-22Sorry, but I can't reproduce the problem.
    651TYPO

    proper syntax is: hors d’oeuvres

    2009-10-14
    532OK

    In the example “create” action for saving multiple models at the bottom of page 532 and continuing on page 533 there is a “rescue” clause that has no associated “begin” which is invalid. There should be a “begin” before the line that reads “Product.transaction do”.

    2009-10-14
    407ERROR

    en:
    activerecord:
    errors:
    messages: # without this line, message override will not work
    taken: “is in use”

    2009-10-26
    277SUGGEST

    DEPRECATION WARNING: :skip_last_comma has been deprecated. Use :last_word_connector instead.

    2009-10-16Already noted on http://www.pragprog.com/wikis/wiki/ChangesInRails23
    161155TYPO

    In the last paragraph on the page.

    “— we’re saying to call the method salt in the current object.”

    This should be “to call the method salt=..” The methods salt and salt= are different methods, and the first clause has it correct. The sentence is self contradictory.

    2009-10-14
    171DEFER

    The book suggests that naming a method after_destroy in the user.rb file will cause ActiveRecord to execute that method as a hook after it destroys an instance of the model.

    Under my rails 2.3.2 and ruby 1.8.6, the method never gets executed.

    If I change the code to this, instead, it works:

    depot/app/models/user.rb


    after_destroy :my_little_destroy_method

    def my_little_destroy_method
    #code raising the exception goes here
    end

    2009-10-26
    338ERROR

    On page:
    named_scope :last_days, lambda{ |days| :condition => [‘updated <?’, days]}

    Didn’t work for me on rails 2.3.2 (although I assume it won’t work on other versions). Worked when I changed it to

    named_scope :last_days, lambda{ |days| {:conditions => [‘updated <?’, days]}}

    ie. pluralized condition and made the hash explicit.

    2009-10-14
    340ERROR

    “Partial Updates and Dirty Bits” on p.351 says that Rails saves only the attributes that have been modified by direct assignment. But “Updating Existing Rows” on p.340 says a column will be updated in the database even if its value has not changed.

    These seem to be conflicting statements. I’m not sure which is correct.

    2009-10-14
    340336DEFER

    The book says in the paragraph about counting that the count function with just one string parameter will use that parameter as a condition (just like the find function previously described). This didn’t work properly when I tried. Instead (and if I understand the rails documentation right) it uses the parameter as a column name and counts all rows where the corresponding value is not NULL.

    2009-10-26
    652TYPO

    In the first line, “we’ll get yourself” should be “we’ll get ourselves”.

    2009-10-14
    652TYPO

    Another pronoun mismatch towards the end of the first paragraph: in “we don’t find out what they are right after you launch our site”, the “you” should be a second “we”.

    2009-10-14
    657ERROR

    The second key generation command fails for me (saying .ssh/authorized_keys2 doesn’t exist). Did you mean /.ssh for those commands? If not, where do expect the commands to be run from? Also, it would be good if it was explained a bit more. Should the key be generated on the web server, and then copied to/.ssh/authorised_keys2 on the SCM server? (in my case, they are different servers).

    2009-10-17
    101OK

    Paragraph #2

    Shouldn’t the last sentence be: Otherwise a new Cart object is created and assigned to the :cart key in the session hash? (rather than assigned to the session).

    2009-10-14
    690TYPO

    The description of config.time_zone says, “If you wish to use another time zone, there following rake tasks …”.
    “there” should be “the”

    2009-10-14
    277DEFER

    While Rails 1.2.6 assumes 30 day months, Rails 2.2.2 seems to be more accurate:

    >> puts Time.now.utc
    Fri May 01 03:12:51 UTC 2009
    => nil
    >> puts 20.months.ago
    2007-09-01 03:12:57 UTC
    => nil

    2009-10-26
    100OK

    Latest rails is 2.3.2
    get rails3-code.zip, then unzip.
    Then go to “pragforms”,
    set RAILS_GEM_VERSION to 2.3.2
    and tried to start the server, but could not do it.

    2009-10-14
    90ERROR

    I tried to populate the table with greek data (greek letters) but rake failed to migrate. I tried single quotes, double quotes and %{…} but no success. With english is ok.

    2009-10-14
    252ERROR

    depot> ruby -I test test/performance/order_speed_test.rb

    …should be…

    depot> ruby -I test test/fixtures/performance/order_speed_test.rb

    …where we’ve nested the performance directory inside the fixtures directory.

    2009-10-16
    381DEFER

    The resource_id referencing Article One should be 1 as opposed to 2. (Though the preceding page says “Let’s clear out our database…” it appears this wasn’t done.)

    2009-10-26
    385TYPO

    id = 2
    name = Article One
    acquired_at = 2008-05-14 12:03:24
    resource_id = 2
    resource_type = Article

    “Notice how all three foreign keys in the catalog have an id of 1”

    They don’t in the output example (resource_ids are 2, 1, 1) — looks like the data wasn’t cleared from the previous example. However, IDs earlier in the output are all 1.

    2009-10-14
    547TYPO

    the footnoted link is dead.

    2009-10-14
    221ERROR

    This page seems to have reverted to an older version of test routines using def instead of test-do without explanation.

    2009-07-08
    100ERROR

    “On line 11, we set the page heading to the value in the instance variable page_title." Line 11 doesn't assign to page_title. Rather, ”Pragmatic Bookshelf" is displayed to the right of the image, which would imply that @page_title evaluates to nil when line 11 is executed, and a fallback string is used.

    2009-10-16
    104TYPO

    “Be sure to include :method => :post in your html_options on your call to link_to.”

    According to the API (api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#M001565), :method is an option, not an html_option.

    PS — I also think it would be better to add the action add_to-cart in this chapter, even if it’s just a stub. You could make it raise “UNIMPLEMENTED” or somesuch.

    2009-10-22The documentation is worded confusingly, but if you look at the examples, you will see :method=>:delete being specified as a html_option in the call to button_to "Delete Image"
    276OK

    Section 16.1 Generally Available Extensions

    The first code sample has

    require ‘rubygems’
    require ‘activesupport’

    However the to_json method is part of activerecord, not activesupport.

    2009-10-14
    276ERROR

    puts {1 => 2}.blank?

    Seems you can’t pass a hash being instantiated to the puts method, the interpreter chokes at the equal sign.

    2009-10-14
    137SUGGEST

    I have been doing the exercises suggested at the end of this chapter. At this point (getting the highlight and blind_down effects working), an earlier exercise broke.

    The exercise was “link the product image to the add_to_cart action”, which had been working fine with the following addition to index.html.erb:
    <%= link_to image_tag(product.image_url),
    :method => :post,
    :action => “add_to_cart”,
    :id => product %>

    This now causes a javascript error, and the WEBrick log has a confusing entry:

    155.34.244.61 - - [11/May/2009:14:47:19 EDT] “GET /store/add_to_cart/2?method=post HTTP/1.1” 200 1553
    h t t p ://fs2:3000/store -> /store/add_to_cart/2?method=post

    This shouldn’t be a GET but a POST. Does the inclusion of Javascript libraries change the behavior of the link_to tag? A footnote or hyperlink to a reference for link_to would be helpful to the reader.

    2009-10-26
    58ERROR

    Shouldn’t the new “def goodbye…end” have triangles in the gutter?

    2009-10-16
    81TYPO

    Current scaffolding uses “products.each do |product|" instead of "for product in products”.

    2009-10-14
    93TYPO

    “See how it has the parameter :confirm =>
    ”Are you sure?“.” should be changed to “See how it has the parameter :confirm =>
    ‘Are you sure?’.” (single quotes) to reflect the actual code.

    2009-10-14
    93OK

    Under explanation of the Destroy link_to: “Also, see the sidebar on this page for some scoop on this action.” — there is no sidebar on this page.

    2009-10-14
    97SUGGEST

    Change “for product in products" to "products.each.do |product|” to reflect the “new” (?) way of doing this.

    2009-10-14
    103SUGGEST

    Why the switching between double and single quotes? Would be nice to know when to use what. On this page button_to uses double quotes where previously link_to uses single quotes.

    2009-10-14
    104DEFER

    Figure 7.3: In Firefox each product has a vertical scroll bar, probably because of the #store .entry { overflow: auto; ..} Change this to “overflow: hidden;” and it works.

    2009-10-26
    96OK

    after inputting this statement “ruby script/generate controller store index”, safari wouldn’t show expected page but a message saying “No route matches ”/store" with {:method=>:get}“. I fixed this by add ”map.resources :store" in /config/routes.rb

    2009-10-14
    135TYPO

    respond.to do .. is indented more than the lines before.

    2009-10-14
    135DEFER

    On page 126 you tell us that variables shouldn’t be passed as globals. But now you pass @current_item as a global variable down to the cart_item partial. I can see why this could be okay because the variable isn’t actually required - but is this the right way to do it?

    2009-10-26
    138TYPO

    “For now, we need it just in the store view” — shouldn’t this be “store views” or “store layout”?

    2009-10-16
    628TYPO

    Last paragraph:
    “There really isn’t much too it.” should read “There really isn’t much to it.”

    2009-10-14
    513OK

    The example <%= number_with_precision(50/3) %> has a typo. I believe you wanted to show <%= number_with_precision(50,3) %> ==> 50.000.

    2009-10-14
    163DEFER

    The code for login.html.erb given on 163 will not display (or wouldn’t for me) the flash notice indicating a failed login (also on 163 at the top). This is addressed when the use of the global “store” layout is implemented on page 168, but it would be useful to note that the code as listed on 163 is functionally incomplete and if a user/reader decides to test a failed login, the error message will not display.

    2009-10-26
    323DEFER

    In the “DB2 Adapter” section of the “Connecting to the Database” chapter, the adapter connection parameter comment should be “ibm_db” not “ibm-db2”

    Also these connection parameters are missing: host, port, account, app_user, application and workstation

    2009-10-26
    624ERROR

    Is the full setup method required in the OrderControllerTest? I thought that they were no longer required with a certain improvement of rails. Also the Rails Guides does it differently by not adding the setup method and accessing the ActionMailer::Base directly rather than setting up a variable for it.

    2009-10-17I'll fix this in the next edition. (It looks like the fixtures declaration is also no longer necessary)
    108OK

    mine is the P1.0 PDF printing - Task C: Cart Creation on Sessions talks about protect_from_forgery in /app/controllers/application.rb referring to a commented out :secret parameter for the protect_from_forgery line. Version 2.3.2 of rails does not make any reference to :secret here… also as others have noted 2.3.2 also places the session_store configurations mentioned in the previous section under config/initializers/session_store.rb

    Clarification on the protect_from_forgery :secret parameter would be nice here.

    2009-10-14
    96ERROR

    Is not neccesary —> #39207: after inputting this statement “ruby script/generate controller store index”, safari wouldn’t show expected page but a message saying “No route matches ”/store" with {:method=>:get}“. I fixed this by add ”map.resources :store" in /config/routes.rb.
    Just Restart Rails webserver.

    2009-10-16
    97ERROR

    delete dot after “each” —> #39204: Change “for product in products" to "products.each.do |product|” …
    “for product in products" to "products.each do |product|”

    2009-10-16
    311ERROR

    The link provided in the footnote points to an empty wiki page. (And I really need that plug-in!)

    2009-10-16
    277TYPO

    state_lookup = us_states.each_with_object({}) do |hash,state|

    should be:

    state_lookup = us_states.each_with_object({}) do |state, hash|

    2009-10-14
    520TYPO

    Text refers to both “stylesheet_link_tag” and “stylesheet_include_tag” — same thing?

    2009-10-14
    521DEFER

    Why is the mislav-will_paginate gem installation process so very different from the “gem install” step recommended elsewhere in the book? Is this page out of date?

    2009-10-26
    205OK

    Issue presumably because of me doing something silly, or Rails 2.3.2 has changed from when the book was written.

    I don’t get the nice error messages when I attempt to submit a blank checkout form in Spanish. Instead, I get the following flash message displayed:

    Address translation missing: es, activerecord, errors, models, order, attributes, address, blank
    Name translation missing: es, activerecord, errors, models, order, attributes, name, blank
    Pay type translation missing: es, activerecord, errors, models, order, attributes, pay_type, blank
    Pay type translation missing: es, activerecord, errors, models, order, attributes, pay_type, inclusion
    Email translation missing: es, activerecord, errors, models, order, attributes, email, blank

    I can add the relevant items to the YAML file but it doesn’t feel very DRY to add the same message so many times?

    es:
    activerecord:
    errors:
    models:
    order:
    attributes:
    address:
    blank: “no puede quedar en blanco”

    Rails 2.3.2
    $ ruby -v
    ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

    2009-10-22I can't reproduce the problem. Try downloading the es.yml file?
    652TYPO

    Last sentence in 28.1 needs s/you/we/
    In fact every other sentence in the intro has an incorrect pronoun in it.

    2009-10-14
    663DEFER

    The link to DeploymentTips on the wiki points to an empty wiki page.

    2009-10-26
    76TYPO

    The command ‘ruby script/generate scaffold product title:string description:text image_url:string’ should be the burgundy colour rather than blue 8 lines from the top

    2009-10-14
    656ERROR

    I believe Passenger became compatible with mod_rewrite as of v2.1, and the current version is now compatible with mod_alias. Perhaps you could point people at the relevant section of the Passenger User Guide for timely information on conflicts.

    2009-10-17Addressed in the next edition.
    0SUGGEST

    I have tried and tried to print the errata page on my color printer so i would have a printed copy of the color coding for tech, error, suggestion, etc. and I can only get a black and white version would be nice if I could print a color version the errata page, which btw is great!!!

    2009-10-14I've changed the css so the colored version should get used when printing the page, too. \n \nNote that if you click the 'Printable Version' button, you'll still get a plain black & white version of the page. \n \n
    107OK

    The line
    config.action_controller.session_store = :active_record_store
    which is supposed to be in environment.rb is no longer there. Instead, this line
    ActionController::Base.session_store = :active_record_store
    should be uncommented in config/initializers/session_store.rb

    2009-10-14
    281TYPO

    In the Section 16.9 Unicode Support, there is a small typo where Kingdom is actually spelt as Kindom

    2009-10-17
    519ERROR

    The second paragraph says: “… We use the pagination_links helper method to construct a nice set of links to other pages.” And then the example uses ‘will_paginate’ instead.

    2009-10-17
    82OK

    The add_test_data migration didn’t work for me until I changed the code to Product.create(…).save! . This is using the default sqlite3 setup.

    2009-10-16I can't reproduce the problem
    418ERROR

    To enable memoization for the model, the class need to extend ActiveSupport::Memoizable

    2009-10-17
    524SUGGEST

    The description for ‘Text Fields’ says: “… The default contents will be taken from @variable.attribute.” Who is ‘variable’? The only connection I can make is with the text on bottom of page 521 that says: “The first parameter does double duty. It tells Rails the name of the object being manipulated … and also the name of the instance variable that holds a reference to that object.” A little too remote. This reference is repeated several times over the next few pages with no further explanation.

    2009-10-16
    113TYPO

    The following phrase contains a word spelled as FU. I do not understand FU, its not a word I have ever heard.

    By now we’re pretty confident in our Rails fu

    2009-10-16"relating to a person - Possessing superior skills in an art; relating to an artifact - representing an expression of high art" -- http://en.wikipedia.org/wiki/Fu
    108TYPO

    In the 2nd paragraph, in the sentence which ends “in the file application.rb in the app/controller directory,” add an ‘s’ to the directory so it is “app/controllers”

    2009-10-22
    108TYPO

    Furthermore, if not mentioned before, in Rails 2.3.2 the application controller is called /controllers/application_controller.rb, not /controllers/application.rb

    2009-10-16Covered in http://www.pragprog.com/wikis/wiki/ChangesInRails23
    89TYPO

    Doesn’t seem consistent to have validates_format_of :message text end with a period

    2009-10-16I'm unable to find this, near page 89, or on any other page
    122TYPO

    In the changes to depot.css in the center of the page shouldn’t there be a comma between “.total-line” and “.total-cell” as there is between “.item-price” and “.total-line”? Without it “Total” at the bottom of the cart seems unchanged.

    2009-10-16The idea is to just bold the total-cell, and only when contained in a total-line.
    219ERROR

    In this entire chapter all the download links download the last version of the file as i is at the end off the ook, not the one as it should be at the point the user is at in the chapter. Thus the results do not work, till you reach the end of the book. Download links need to match the text in the book, except for corrections. It leaves the reader confused.

    2009-10-22
    320DEFER

    With regards to model.column? expression for ActiveRecord booleans, the book says the following:

    “This form of attribute accessor looks at the column’s value. It is interpreted as false only if it is the number 0; one of the strings ”0“, ”f“, ”false“, or ”" (the empty string); a nil; or the constant false. Otherwise, it is interpreted as true."

    This implies that a varchar(1) field should work (and it did for me in Rails 1.2), however, in MySQL 5.0.x under Rails 2.3.2 if the field is a varchar, the model.column? will always return true. If the column is changed to tinyint(1) then expected behavior occurs—however, the values are limited to 0 and 1.

    I haven’t reviewed the Rails source code about this, but I just went through some emperical testing to solve a Rails 1.2 to 2.3 update problem with this.

    2009-10-26
    252TYPO

    In the code below the > at the beginning of the second line is spurious, it does not belong there.

    depot> ruby script/performance/benchmarker \\
    > ‘User.encrypted_password(“secret”, “salt”)’

    2009-10-16That's the continuation prompt on Mac OSX and Linux.
    136SUGGEST

    I actually have P2.0 version 2009-04-07.

    On p. 136, “CONSTRAINT fk_line_item_products REFERENCES products(id)” is used to add a foreign key constraint. MySQL doesn’t complain, but it also doesn’t add the foreign key constraint. When I use “show create table line_items;” it doesn’t show the constraint, however, when I use “show create table” on my other databases, I can see the foreign key constraints are there.

    This is probably worth mentioning at least in a footnote. I was copying that code into my other apps, only to find out later that I didn’t actually have referential integrity ;)

    Thanks!

    2009-10-16As stated on the page, this SQL code is specific to SQLite3.
    342ERROR

    The first code snippet in the NAMED AND ANONYMOUS SCOPES seems to contain 2 errors:

    1) :condition should be :conditions

    2) The :conditions section should be wrapped in another set of braces {}

    2009-10-17
    91ERROR

    the downloadable file “depot_c/app/views/products/index.html.erb” differs from the version in the book.
    The book-version works fine for me. By using the downloadable file it throws an error, saying that truncate doesn’t know the option :length => 80.

    2009-11-03
    611ERROR

    I have the third edition of the book, print 2009-04-07.

    It says, “We have to give render the explicit path to the template (the leading ./).” However, the code doesn’t use “./”

    2009-10-17
    358SUGGEST

    “You can also choose to establish these constraints in your
    migrations (and we recommend that you do)”

    How?

    2009-10-16An example was given on page 143
    205ERROR

    I encountered the same problem as James Abley, but discovered that it is caused by incorrect nesting of key/values in the YAML file. The “messages” key should be one level deeper than “errors” and on the same level as “template.” I mistakenly had it nested underneath “template” which caused the errors noted above.

    As someone new to YAML, it hadn’t occurred to me that indentation was significant until I discovered this resolution, though now it is quite obvious that it is.

    2009-10-17
    205ERROR

    With Ruby 1.9 and Rails 2.3.2 I get the following error: “Encoding::CompatibilityError in Store#checkout Showing app/views/layouts/store.html.erb where line #52 raised: incompatible character encodings: ASCII-8BIT and UTF-8” where Line 52 is “<%= yield :layout %>”.
    It occurs when I’ve set the language to Spanish and click the checkout button. Seems to be a Ruby 1.9 specific problem.

    2009-10-16While this edition does not cover Ruby 1.9, You might be able to get further with yield.force_encoding('utf-8').
    573ERROR

    I have printing p2.0, April 2009.

    In the code example at the bottom of the page, it uses “periodically_call_remote”, but it passes a argument “:condition” argument. I don’t think the code makes sense since the innerHTML will only be “Unknown” the first time, so there’s no point in calling it periodically ;)

    2009-10-16This is for the case where it might take several minutes to get the inbox
    437ERROR

    the requirements option attached to map.connect can be rewritten as :requirements => { :year => /(19|20)\\d\\d/, :month => /$/, :day => /(0*[1-9]|[12]\\d|3[01])$/ } to accommodate single and double digit parameters for both days and months. These refinements are more accurate (the original patterns produce erroneous results) and at the same time remove the need to explain the work-around in the next two paragraphs.

    2009-10-16Here the goal is to have one url per day (i.e., no synonyms like 2010/01/01 vs 2010/1/1), and to illustrate a common pitfall. Removing the asterisks from your patterns would make the pattern more accurate, albeit a bit harder to understand for the target audience for this book.
    220OK

    (Mobi version not PDF but there wasn’t an option for mobi location)

    All of the fixture examples in “Unit Testing of Models” have the problem of not containing IDs. One example is at location 4834-40. Rather than…

    ruby_book:
    title: Programming Ruby

    It is:

    title: Programming Ruby

    2009-10-28ids have not been required since Rails 1.x.
    342TYPO

    “Such a named scope would make finding the last weeks worth of orders a snap:” should probably be “Such a named scope would make finding the last week’s worth of orders a
    snap:”

    2009-10-17
    94SUGGEST

    The “localhost:3000/products” pointer on the top of the page could be a link (like the one on page 96, second paragraph).

    2009-10-17
    657ERROR

    The commands for generating keys expect the user to be in the home folder, but the previous set of commands changed directories to ~/git/depot.git —if the user does not alter the “cat” command or change directories, the command will fail.

    2009-10-17
    539SUGGEST

    It might be an idea to show how to ignore labels for hidden fields in the create_tagged_field method

    2009-10-22
    663TYPO

    script/runner code looks wrong; should be:
    [“updated_at > ?”, 12.hours.ago])

    ie. greater than, not less than.

    2009-10-22
    551SUGGEST

    content_for should appear in the index

    2009-10-22
    139OK

    i’am noob here but.. if I write redirect_to_index in definition of empty_cart —-> browser returns me an error when i try to empty my cart. but it works normally if i write redirect_to :action => ‘index’.

    2009-10-28I can't reproduce.
    405DEFER

    validates_presence_of should not be documented to have :allow_nil and :allow_blank options. These options are not implemented and are not listed in official documentation such as http: //api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#M002164

    2009-10-26
    663DEFER

    Regarding log rotation, don’t the same problems associated with letting Logger handle rotation exist for Passenger? There will be multiple processes (created by the application spawner) potentially trying to rotate the log file at the same time. A suggestion I see in other places is to use the same logrotate service used for Apache and installed on most Unix servers.

    Also re: log rotation, the link to the Rails wiki is broken since the wiki was rebooted in early 2009.

    2009-10-26
    103ERROR

    In this page the author suggests to add a few lines of code to the depot.css stylesheet we have because the button we added does not display properly (according to the author). However, those lines of code the author wants to add to the stylesheet are already there! (From the stylesheet downloaded in page 90) So the reader does not get to see the bad formatting the new buttons cause.

    This isn’t a huge problem but I think if you omit those lines in the first stylesheet for depot.css the user will experience the change better.

    If you need anything else I guess you know how to contact me.

    2009-11-03
    436TYPO

    The following sentence ends in a colon, which suggests that there should be code that follows, but there is no code:

    Perhaps surprisingly, this form is less efficient than passing a hash of values:

    Also, a comment on this form: the Version of Book With Error drop box on this page doesn’t include the edition of the book that I am using: P3.0 Printing, July 2009.

    2010-01-14
    137OK

    The flicker of the blind-down effect on the div (mentioned on p.137) is not actually solved by the new hidden div on p.137 and 138, using either of the two solutions (the “danging >” version or the helper module version). I am using Safari and Firefox on a Mac. Once every 15 or 20 times, it appears without a flicker, for no discernible reason. But a betting person could make a lot of money on the flicker being present.
    As an experiment, I rewrote it using this:
    <% unless @cart.items.empty? %>

    …etc
    I did that just to test how long the flicker would have lasted using a more “brutal” approach, and it’s the same amount of time. I’ve double-checked all the code (the correct version, not my experiment), restarted the server, cleared and restarted the browsers… I suppose the hidden div is redisplayed before the blind-down effect, so it doesn’t really eliminate the flicker. Any way this can be helped?

    2010-01-14See #41356
    137OK

    beg your pardon: before adding my comment about flickers i neglected to notice that my
    <% hidden_div_if…
    portion of the layout was actually still surrounded by the old

    . deleting that solved the flicker, of course.
    apologies for seeming error-happy.

    2010-01-14
    #159OK

    I definitively do not catch the comment related to #159: “Since this modified config/routes.rb, which is cached for per formance reasons, you will need to restart your server.” - Maybe a listing explaining what has been changed in ‘config/route.rb’ is missing?
    By the way I have a P1.0 release dated 2009-2-26 and the concerned page is numbered #153

    2010-01-14The line about "this" is "ruby script/generate scaffold user name:string hashed_password:string salt:string". In Rails 2.x, a server restart is required after every script/generate in order to pick up the changes that command makes to config/routes.rb. Thankfully, this will no longer be necessary in Rails 3.0. \n
    203DEFER

    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.

    50OK

    In addition to the routing error, I was able to resolve this by adding the route map.connect ‘:controller/:action’ to my routes file. You should discuss this portion just before introducing the templates (view) portion.

    2010-01-14That shouldn't have been necessary - the config/routes file should already have "map.connect ':controller/:action/:id'"
    77OK

    There is no table schema_migrations on my instance.

    2010-01-14Are you using a version of Rails prior to 2.1? 2.0 used schema_info; but differs in a number of significant ways from the description in the text. \n \nhttp://api.rubyonrails.org/classes/ActiveRecord/Migration.html
    92DEFER

    The client requested we display the purchase price,however your update did not include the purchase price.

    2010-01-14
    92OK

    Include the CSS

    2010-01-14This was covered on page 90, and the full css file can be found on page 721.
    18DEFER

    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.

    37TYPO

    [NOTE: This erratum pertains to the July 2009: P3.0 printing (at least according to the footer in my PDF file), but this was not available in the drop-down Version list.]

    The first paragraph in “Editors” section reads, “But many think that neither Emacs nor VIM are ideal…” Grammatically, it should be “neither Emacs nor VIM is ideal…” Both subjects are singular, so the verb should agree. You wouldn’t say “Emacs are ideal” or “VIM are ideal”.

    2010-01-14
    657DEFER

    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.

    476TYPO

    Typo: pretty much all of our functional test -> pretty much all of our functional tests

    2010-01-14
    655OK

    UbuntuServer:/$ sudo passenger-install-apache2-module sudo: passenger-install-apache2-module: command not found ...UbuntuServer:/$

    Note: Book version is actually
    P3.0 printing. July 2009
    Version: 2009-7-7

    2010-01-14This works for me, and matches the documentation: \n \nhttp://www.modrails.com/install.html \n \nThe only thing I can think of is that you may have missed the instructions in section 3.4 which state that you may need to add /var/lib/gems/1.8/bin to your PATH environment variable.
    76OK

    I have the printed book P3.0 printing, July 2009.

    On page 76 it says “You can fix this … in app/views/products/show.html.erb” The indicated edit has no effect on my Mac, but doing the corresponding edit (i.e., removing the h) on line 14 of index.html.erb does have the desired effect. My environment:

    Ruby version\t1.8.7 (universal-darwin10.0)
    RubyGems version\t1.3.5
    Rack version\t1.0
    Rails version\t2.3.5
    Active Record version\t2.3.5
    Active Resource version\t2.3.5
    Action Mailer version\t2.3.5
    Active Support version\t2.3.5
    Application root\t/Users/duane/Rails/depot
    Environment\tdevelopment
    Database adapter\tsqlite3
    Database schema version\t20091219180720

    2010-01-14This part of the text is referring to "the markup that you entered in the description appears when showing the product", and that problem can be fixed by editing app/views/products/show.html.erb.
    171DEFER

    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.

    204DEFER

    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&oacute;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…

    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 \n \nI plan to address this in the next edition.
    114OK

    Missing multiplication of quantity in total_price method?

    def total_price
    @items.sum {|item| item.price * item.quantity}
    end

    2010-01-14Multiplication of quantity is done inside of CartItem's price method: \n \ndef price \n @product.price * @quantity \nend \n \nSee http://media.pragprog.com/titles/rails3/code/depot_g/app/models/cart_item.rb
    76SUGGEST

    In printing 3.0, July 2009:

    The entire text starting on p. 76 (“As a quick example…”) appears to be misplaced or out of context. It doesn’t really follow logically from the previous paragraph on p. 75. Perhaps some re-editing is needed.

    2010-01-14I can see how the current text suggests that this is a new example, but really what it trying to convey is that what we have done so far has "One small problem", ... which can be fixed by deleting the "h"; therefore, I simply changed "As a quick example" to "One small problem".
    84ERROR

    “You can fix this by deleting the h that appears on the @product.description line in app/views/products/show.html.erb:”

    should read

    “You can fix this by deleting the h that appears on the @product.description line in app/views/products/index.html.erb:”

    Doing as the book suggests has no impact on the view. Removing the ‘h’ in both files fixes it, as does simply removing the ‘h’ in the index file as opposed to the show file.

    2010-01-14This part of the text is referring to "the markup that you entered in the description appears when showing the product", and that problem can be fixed by editing app/views/products/show.html.erb.
    114DEFER

    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.

    137DEFER

    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

    <%= product.title %>

    113OK

    Yes, please explain: current_item = @items.find {|item| item.product == product}

    2010-01-14The book already contains a pointer to the description of iterators on the right hand side of the page. \n \nMore information on Ruby's find method can be found at http://ruby-doc.org/core/classes/Enumerable.html#M003122
    26TYPO

    Well, I actually have version P3.0, but that’s not an option…
    This page suggests we go to “wiki.pragprog.com/changes-to-rails” for a list of changes that will affect people with later versions than 2.2.2, but this page does not exist on the pragprog.com site. The correct link (I think) is “pragprog.com/wikis/wiki/ChangesInRails23 ”

    2010-01-14I changed it to http://www.pragprog.com/wikis/wiki/ChangesToRails
    143DEFER

    I realize that the Store application is designed to give someone unfamiliar with Rails a really quick tour of what an awesome app you can make in a short time. Nevertheless, I feel like the discussion on the foreign key sqlite3 “hack” is a bit….hand-wavey? I don’t know a lot about sqlite3 or SQL in general, but it feels like the book skips over this pretty quickly.

    When learning from a book i think “Hm, would i have thought to do that? Maybe with some Google-fu?” as a measure of “Did you really get it.” I don’t think I would have come to putting these DDL calls in unless I had seen it in the book.

    Maybe explain what’s going on here? Or put it in a footnote? Or a Joe Asks? Or cover the theory in one of the later chapters about DB design?

    2010-02-13This will be removed in the next edition.
    412DEFER

    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.

    344OK

    About halfway down the page “In addition to the save method…in a single call to update_attribute:”, should read “in a single call to update_attributes:” (the method name is pluralized).

    2010-04-12There are two similarly named methods. update_attribute (singular) takes two parameters: a name of an attribute, and the value to set that attribute to. update_attributes (plural) takes a single parameter: a hash of name/value pairs.
    104OK

    in 8.3 iteration C2: Creating a Smarter Cart,

    when creating the initial CartItem model class,

    the price function is defined thusly :

    def price
    product.price = quantity
    end

    unfortunately that sets the price to the number of items set in the cart (if you add the item 3 times the price is 3, not $99.88)

    it should be :

    def price
    @product.price
    end

    Also, once this is done, the total_price needs to be adjusted (8.5 Iteration C4:finishing the Cart) be modifying the total_price function from:

    def total_price
    @items.sum { |item| item.price }
    end

    to the correct :

    def total_price
    @items.sum { |item| item.price * item.quantity }
    end

    2010-04-12Actually, the price function is defined as follows: \n \n def price \n @product.price * @quantity \n end \n \nThat is an asterisk, not an equals sign.
    431ERROR

    I have version 2.0 from April 2009.

    This code snippet isn’t quite right. The code doesn’t match the URL that is generated:

    app.url_for :controller =) :store, :action =) :display, :id =) 123
    =) http : / / example.com/store/status

    (Since less than and greater than aren’t allowed, I had to use “(” and “)”.)

    2010-04-12
    267OK

    namelist> ruby db:migrate is wrong

    It should be
    namelist>rake db:migrate

    2010-04-12I double checked and see "rake db:migrate". I vaguely remember fixing a problem like this before, but I even went back to the first printing, and it was correct there.
    632DEFER

    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.

    563DEFER

    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.

    105OK

    I’m new at this so it’s veryy possible I’ve done something wrong, but I can’t figure out what that might be.

    I’m trying to do the iteration C2:creating a smarter cart and I keep getting an error when I try to add an item to the cart. The error is “uninitializ3ed constant Cart::CartItem”

    Here is the information that displays on the screen:

    NameError in StoreController#add_to_cart

    uninitialized constant Cart::CartItem

    RAILS_ROOT: /home/bobwork/work/depot
    Application Trace | Framework Trace | Full Trace

    /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:105:in `const_missing’
    /home/bobwork/work/depot/app/models/cart.rb:17:in `add_product’
    /home/bobwork/work/depot/app/controllers/store_controller.rb:10:in `add_to_cart’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `send’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:1331:in `perform_action_without_filters’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:617:in `call_filters’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
    /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms’
    /var/lib/gems/1.8/gems/activesupport-2.3.5/lib/active_support/core_ext/benchmark.rb:17:in `ms’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/rescue.rb:160:in `perform_action_without_flash’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/flash.rb:146:in `perform_action’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `send’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:532:in `process_without_filters’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/filters.rb:606:in `process’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:391:in `process’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:386:in `call’
    /var/lib/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/routing/route_set.rb:437:in `call’

    2010-04-12Unfortunately, I don't have enough information to help you debug this. Check that the following file: \n \n /home/bobwork/work/depot/app/models/cart_item.rb \n \nStarts with the following (case is significant): \n \n class CartItem \n \nAlso verify that there are no syntax errors in the file itself: \n \n ruby app/models/cart_item.rb \n \n \nIf you have more information or questions, I would suggest using the forums rather than errata: \n \n http://forums.pragprog.com/forums/66
    166OK

    Scaffold generated code for index.html.erb uses

    <% @users.each do |user| %>

    to display the users

    while the book lists

    <% for user in @users %>

    2010-04-12The book reflects Rails 2.2.2. This changed in Rails 3. I've updated the following page: \n \nhttp://www.pragprog.com/wikis/wiki/ChangesInRails23
    62DEFER

    Don’t go on so much about how silly it is to not use SQLLite for the exercises. I’m using MySQL specifically to ensure that I’m in practice for my target platforms. It comes off as a bit of attitude, and I am quite sure that’s not what you intend.

    Also, I would love for the SQL-phobic comments not to be in the text. They can make the text tiring to read for those of us that are comfortable with the database technology.

    Great book overall though.

    2010-04-27
    81OK

    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”.

    2010-08-15Unable to find this text
    523DEFER

    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.

    31DEFER

    MySQL is included in InstantRails, not SQLite

    2010-08-15
    734TYPO

    Index lists assert_not_match. Should be assert_no_match.

    2010-08-15
    378DEFER

    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

    163OK

    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?

    2010-08-15Correct as is. hashed_password is the name of a field, not a symbol.
    102OK

    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.

    2010-08-15See http://pragprog.com/wikis/wiki/ChangesInRails23
    337TYPO

    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”’)

    2010-08-15
    506DEFER

    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.

    610DEFER

    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?)

    2010-08-15
    7-1TYPO

    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

    343DEFER

    all is not a scope, it’s a class method def which calls find :all - it doesn’t return a scope proxy

    2010-08-15
    32OK

    rails dummy_app should read rails new dummy_app

    2010-08-12Not in rails 2.3.x.
    151DEFER

    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.

    479ERROR

    The link to media.pragprog.com/ror/sessions in footnote 8 of chapter 22 gives a 404 error.

    2010-08-15
    68OK

    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.

    2010-08-15In database.yml, you will see a line like "database: db/development.sqlite3".
    560DEFER

    The last part of the section on caching needs cleanup or more explanation:

    ActionController::Base.cache_store =

    :mem_cache_store, “localhost” ActionController::Base.cache_store = MyOwnStore.new(“parameter”)
    This stores fragments in a memcached server.

    0DEFER

    Notice, I’m not completely sure as I’m really new in ruby.

    In the integration test “dsl_user_stories_test.rb” when defining the function user.has_a_cart_containing(*products)

    the loop :

    for item in cart.items
    assert products.include?(item.product)
    end

    should be replaced by :

    cart_products = cart.items.collect{|item| item.product}
    for product in products
    assert cart_products.include?(product)
    end

    in order to respect the function name

    279TYPO

    Is it Rails 1.9 or Ruby 1.9? I don’t think there is a Rails version 1.9. :-)

    “Finally, Rails provides an ActiveSupport::Multibyte::Chars and an mb_chars on the String class. On Rails 1.9, mb_chars returns self, but on Ruby 1.8 it wraps the string in a multibyte proxy:”

    76TYPO

    On page 76 there is this code “ruby script/generate scaffold product \\ title:string description:text image_url:string”

    It is expected that the user executes this line of code and the convention in the book has been to print such commands the user must type in as a bold brown font.

    In the above line, it’s printed as blue which is by previous convention in the book has been for examples.

    The page also fails to make it clear that UNIX/OS X users need to remove the / mark as well, not just for windows users.

    510ERROR

    you cover the building of an XML template for products but the output generated is not consumable by ActiveResource
    After a lot of research it seems that the output is missing the type=“array” declaration for products.

    It seems inconsistent and possibly a bug with Rails but it would be good if the book covered how to produce XML that would work with ActiveResource when using xml_builder

    NoMethodError: undefined method `collect!’ for # is the error returned.

    736TYPO

    The index, on page 736, refers to a “breakpointer command” that is supposedly described on page 273. However there is no such reference on that page, neither in the entire book. I suspect this index entry applied to an earlier version of the book (and Rails) and is now orphaned.

    489ERROR

    The following is incorrect:

    “If a before filter returns false, processing of the filter chain terminates, and the action is not run. A filter may also render output or redirect requests, in which case the original action never gets invoked.”

    A before_filter does not stop processing the filter chain on on return false any longer.

    From release notes of Rails 2.0.1:

    • Changed before_filter halting to happen automatically on render or redirect but no longer on simply returning false [David Heinemeier Hansson]
    194ERROR

    If I put the code on that page into layouts/store.html.erb exactly as it is then current locale isn’t selected in the locales select box. At least in Rails 2.3.10 the I18n.locale returns :en (symbol) and it doesn’t match “en” string. I18n.locale.to_s fixed that.

    280SUGGEST

    “Seems to us that gooses is a verb, not a plural noun.”

    I’m not sure if this is appropriate.

    2011-08-30(Dave Thomas: Then I feel sorry)
    302TYPO

    “ruby script/generate migration load_users_data”
    should read:
    “ruby script/generate migration load_user_data”

    648TYPO

    it seems that the command “ruby script/plugin install ssl_requirement” does not work. The result of this is “Plugin not found: [”ssl_requirement“]” ?!

    10SUGGEST

    this book covers a lot less than version 3.
    I seem to be unable to find out about a lot of things such as STI, polymorphic model’s, view select helpers to mention just a few off the top of my head.
    Version 3 of this book was way more comprehensive, it would be good to see that comprehensiveness continue on into the future.

    168TYPO

    In the first paragraph of section 11.4, the filename for the application controller is shown as “application.rb.” I believe it should be “application_controller.rb.”

    190TYPO

    In the listing at the top of page 190, for application.rb, I believe there’s a ‘begin’ keyword missing as the first line of the set_locale method. The ‘begin’ keyword would match with the ‘rescue’ block later in that method. Leaving the ‘begin’ keyword out generates an error, while including it enables the script to work.

    190TYPO

    I believe the fourth line of the set_locale method should read:

    locale_path = “#{LOCALES_DIRECTORY}/#{I18n.locale}.yml”

    (notice there’s a slash in the middle which does not appear in the book’s version).

    194ERROR

    The es.yml and en.yml files are missing colons in front of most of the symbols. For example, “side:” needs to be “:side:”. The symbols for home, questions, news and contact also appear to need colons in front.

    193TYPO

    In the listing of index.html.erb, change the text between the h1 tags to read ‘layout.title’ instead of ‘main.title’. Also change the submit_tag line to read ‘layout.button.add’

    75ERROR

    git-repoconfig is deprecated in favor of git config:

    git config —get-regexp user.*

    150TYPO

    it can be found in controller of order in create action that is called when you place order

    111ERROR

    At the end of Iteration C1 after I click OK , I get the following error:
    ———————————————————————-
    NoMethodError in Store#add_to_cart

    Showing store/add_to_cart.html.erb where line #3 raised:

    You have a nil object when you didn’t expect it!
    The error occurred while evaluating nil.items

    Extracted source (around line #3):

    1:

    Your Pragmatic Cart

    2:

      3: <% for item in @cart.items %>
      4:

    • <h item.title>

    • 5: <% end %>
      6:

    RAILS_ROOT: C:/InstantRails/rails_apps/depot
    Application Trace | Framework Trace | Full Trace

    app/views/store/add_to_cart.html.erb:3:in `_run_erb_47app47views47store47add_to_cart46html46erb’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:637:in `send’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:637:in `compile_and_render_template’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1100:in `render_for_file’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:836:in `render_with_no_layout’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/layout.rb:262:in `render_without_benchmark’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render’
    C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1153:in `default_render’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1164:in `perform_action_without_filters’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
    C:/InstantRails/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:76:in `process’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in `synchronize’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/rails.rb:74:in `process’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:159:in `process_client’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in `each’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:158:in `process_client’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `initialize’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `new’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:285:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in `initialize’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in `new’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel.rb:268:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:282:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:281:in `each’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/configurator.rb:281:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:128:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/lib/mongrel/command.rb:212:in `run’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/mongrel_rails:281
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64
    C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require’
    C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39
    C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    C:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    script/server:3

    Request

    Parameters:

    {“authenticity_token”=>“587893cd7c8c43b02b548577ce3a36a82216a111”,
    “id”=>“4”}

    Show session dump


    flash: !map:ActionController::Flash::FlashHash {}

    Response

    Headers:

    {“cookie”=>[],
    “Cache-Control”=>“no-cache”}

    214ERROR

    The test code example uses error.invalid?() which has been since version 3 of Rails.

    211ERROR

    I’m using Rails 4.2.3. The test directory structure has changed to:
    >ls -p test
    controllers/ fixtures/ helpers/ integration/ mailers/ models/ test_helper.rb
    which differs from this “most recent” version of the ebook.

    166">ERROR

    ">

    google

    1ERROR

    Traceback (most recent call last):
    File “/Users/rachel/code practice”, line 5, in
    password=input(‘please enter your password ’)
    File “”, line 1, in
    NameError: name ‘monkey’ is not defined

    Categories: