By Developers, For Developers

Historical errata for Agile Web Development with Rails

element" should be "a

element"

whereas when introduced on page 117 it was as follows:

"

(Dave says: I’m happy the way it is…)

in the loop in the code sample on the page and in the download.

Download e1/views/app/views/pager/user_list.rhtml

PDF PgPaper PgTypeDescriptionFixed onComments
67ERROR

Under “Create the Maintenance Application”, it says we’ve created our development, test, and production databases, but at this point we’ve only created the development database (on Page 59).

2006-05-02
75TYPO

Caption for Figure 6.4: “rpice” should be “price”

2006-05-02
79TYPO

“tablein” should be “table in” in sentence “It would be nice if we could load the data into our tablein a more controlled way.”

2006-05-02
81TYPO

Bullet item “We used Ruby’s sprintf() method …” - in the preceeding rhtml fragment sprintf() is never called.

2006-05-02
81TYPO

Bullet item “We used Ruby’s sprintf() method …” - “divied” should be “divided”

2006-05-02
86TYPO

“is” should be “in” in “… we jointly decided to see what happened if we displayed the products is alphabetical order …”

2006-05-02
86TYPO

Last paragraph on page, missing “we” in “This time, we used the h(string) method …”

2006-05-02
88TYPO

“ona” should be “on a” in “Pragmatic Web Designer is off getting inspiration ona beach somewhere …”

2006-05-02
89TYPO

Last paragraph, “that” should be “than” in “It’s starting to get a bit long, so rather that include it inline …”

2006-05-02
90TYPO

Second to last paragraph, “renefered” should be “referred” (or possible “referred to”) in “The methods we define in a controller-specific helper are available to views reneferred by that controller.”

2006-05-02
91SUGGEST

The format string for sprintf() could be “$%d.%02d” instead of “$%d.%02.2d” since cents will always be in 0..99 (marginally easier to parse by the reader).

2006-05-02
92TYPO

Second paragraph, “one” should be “want” in “And a POST request is just the ticket when we one to do something like add an item to a cart.”

2006-05-02
66TYPO

Top of page
——————

wil create and drop…

should be,

will create and drop

2006-05-07
2TYPO

The word “change” is misspelled as “cdhange” in the sentence that reads, “For programmers used to other web frameworks, where a simple cdhange to the schema could involve them in half-a-dozen or more code changes, this was a revelation.”

2006-05-07
79OK

Add a space between the words ‘table’ and ‘in’ (third paragraph, next to last sentence)

“It would be nice if we could load the data into our tablein a more controlled way.”

Should be,

“It would be nice if we could load the data into our table in a more controlled way.”

(Dave says: I see a space there)

2006-05-22
96TYPO

“it you now look at your database” should be…

“if you now look at your database”

2006-05-07
6TYPO

Under the “Change Log” the first sentence reads: There are probably a thousand changes that have been applied to Rails since the first version of this book wen to press.
I think it should read: “…since the first version of this book went to press.”

2006-05-07
96ERROR

Running “rake db:sessions:create” does not create a new table called “sessions”, it creates a new migration for adding the “sessions” table.

You must run “rake db:migrate”, as well.

2006-05-07
97TYPO

Omit the word ‘and’. (Paragraph before ‘Creating a Cart’ section.
—-

"Be careful as you add additional methods to this controller as we work further on the cart

2006-05-07
97TYPO

Last line on page.

“The cart is basically a wrapper for an array of atems.”

should be,

“The cart is basically a wrapper for an array of items.”

2006-05-07
26ERROR

Hi David, nice 2nd edition! I’m Marc, one of the developers from the RadRails team. Thanks for the plug in the book, that’s awesome! One correct though, we didn’t win a Jolt award, it was the Best Open Source Developer Tool based on Eclipse award. Thanks again!

2006-05-07
99OK

Change ‘tart’ to ‘start’


"Let

2006-05-07
99TYPO

Change “you’ve” to “you’re” (Last paragraph)


"Your browser will probably warn you that you

2006-05-07
102TYPO

Change “out” to “our”


"Rather than out new cart, we

2006-05-07
103TYPO

Change “out” to “our”

"…we

2006-05-07
28SUGGEST

It may be somewhat damning to suggest that there are “There are no fully-fledged IDEs for Ruby or Rails.” especially given the existence of RadRails.

That said, Textmate owns and I’m glad to see proper respect paid here :-)

Just wouldn’t want the book to appear too dated even before it goes to print.

2006-05-07
33TYPO

“WEBRick or Lightthpd?” Lighttpd is misspelt with an extra h in the header of the callout

2006-05-07
65SUGGEST

I would be nice to see an example of prefilling tables from
migration code. For example if you want to want a table to allready contain an admin or something like this.
cheers

(Dave says: this wil be in the migrations chapter)

2006-05-07
124TYPO

5th paragraph - `Just look at the
cart in the sdiebar.’

2006-05-07
23TYPO

“managerl” should be “manager”

“It has one slight disadvantage: you delegate control of your installation layout to the package managerl.”

2006-05-07
25OK

Could we get a pointer to using Subversion with Rails here? Maybe a condensed version of http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion or http://maniacalrage.net/past/2006/4/12/heres_how_i_create_a/ or http://blog.teksol.info/articles/2006/03/09/subversion-primer-for-rails-projects

(Dave says: I think that’s probably out of scope, and I’m leary about pointing to blog entries from the book)

2006-05-07
1TYPO

In the first paragraph, second sentence, the word “a” is missing between “being” and “worldwide”. It should be, “… Rails went from being an unknown toy to being a worldwide phenomenon.”

2006-05-07
23TYPO

In the fifth paragraph, second sentence, you refer to “OX X” instead of “OS X”.

2006-05-07
25TYPO

In the footnote at the bottom of the page, (where else do footnotes live?), in the second sentence, the word “to” is missing between “you” and “type”. It should read, “It allows you to type the …”

2006-05-07
26TYPO

In the footnote at the bottom of the page, second sentence, you have the word “you’re” instead of the word “you’ve”. It should read, “That’s before you’ve written a thing….”

2006-05-07
118TYPO

Change ‘out’ to ‘our’. (First paragraph on page)
—-
"To do that, let

2006-05-07
120ERROR

At this point, the suggested change to the store_controller.rb should be

redirect_to :action => :index

instead of,

redirect_to_index

The redirect_to_index method requires a “msg” for the flash

(Dave says: I shows the updated version of redirect_to_index instead)

2006-05-07
121ERROR

“So, open up store.rhtml in the app/views/layouts directory, and replace the button_to( ) call with something like this:”

Should be,

“So, open up index.rhtml in the app/views/store directory, and replace the button_to( ) call with something like this:”

2006-05-07
41OK

In the “Ho! Ho! Ho!” example, an extra line break is inserted before “Merry Christmas!”, but the code would not cause that line break.

(Dave says: The output shows the generated HTML, not the appearance on the screen. It will have a blank line)

2006-05-07
27TYPO

The first word on the page should be “Arachno” instead of “Aracho”.

2006-05-07
116SUGGEST

You mention that components have fallen out of favor in the Rails community. However, nowhere does it seem to be explained why components are seeing less use, nor are we ever told what is being used to supplant them. For those of us who’re already using components in our applications, it would be nice to see what problems the Rails community has had with them, as well as have suggestions of what to migrate them to—especially if there’s any intention to remove components from Rails in subsequent releases.

2006-05-22
27TYPO

The third paragraph in the section named “The Desktop”, third sentence, the word “tree” at the end of the sentence should be plural.

2006-05-07
101TYPO

Although the error and subsequnt technique for fixing it is discussed on page 103, the code listing for app/models/cart.rb on page 101 already includes the line:

include Reloadable

I would assume you meant to leave it out until later…

2006-05-07
28TYPO

In the first paragraph, the last sentence doesn’t make sense. It should be rewritten to be something like, “The Rails database adapters hide these differences so that a Rails application doesn’t need to know what kind of database it is running on.”

2006-05-07
61TYPO

Inside the “Selecting a Different Database” box, last sentence: “… apppropriate …”

2006-05-07
66TYPO

Second paragraph: “Edit the file so that in looks like the following.” s/in/it/

2006-05-07
66TYPO

Footnote: “Your scheme will be transported back in time…” s/scheme/schema/

2006-05-07
74TYPO

Footnote: “so Rails store …” s/store/stores/

2006-05-07
70TYPO

Change “scoffolding” to “scaffolding”.

2006-05-07
138SUGGEST

Syntax highlighting for many .rhtml code examples in the book are inconsistent and not colored properly. For instance, almost every occurance of a closing html tag has the greater-than symbol the wrong color. Minor detail, but noticable…

2006-05-07
137TYPO

Third paragraph after the app/controllers/store_controller.rb code example, it says:

“Or maybe the user has tried to enter an order, but thier data hase failed validation.”

Where it should be the word “has”:

“Or maybe the user has tried to enter an order, but their data has failed validation.”

2006-05-07
137TYPO

Last paragraph states:

“These helpers interactive with the controllers…”

Where it should be “interact”…

2006-05-07
73TYPO

“shouw” should be “show”

2006-05-07
128TYPO

Next to last paragraph: "… let

2006-05-07
131TYPO

Next to last paragraph: “… as we saw, startign with a conventional application mkes it easier …” s/startign/starting/, s/mkes/makes/

2006-05-07
141TYPO

Footnote 5: “… being fed values fromthe forms it creates.” s/fromthe/from the/. Also, “If there were to set an unknown payment type, …” s/there/they/?

2006-05-07
143ERROR

Although mentioned several times, it appears the requisite code to implement validation on the Order model has been skipped. Consequently the suggestion to place an order without filling in any of the form fields succeeds in placing an order without any details.

2006-05-07
168TYPO

example rxml code shows “xml.name” but Figure 12.2 on the next page shows it as being “title”

2006-05-22
22TYPO

Footnote 3 refers to “global Window’s environment” which should probably be “global Windows environment” instead.

2006-05-07
88SUGGEST

shouldnt YIELD be used instead of content for layout?

(I’m fighting hard not to have @content_for_layout deprecated. In fact, I just talked with DHH, and content_for_layout isn’t going away)

2006-05-09
27TYPO

In ‘The Desktop’ the 2nd sentence of the 2nd paragraph ends in ’ and a browser window permentently open’ where it should be ’ and a browser window permanently open’.

2006-05-07
25TYPO

In Editors paragraph:

"I

2006-05-07
89ERROR

The logo.png provided at http://media.pragprog.com/titles/rails2/code/depot_e/public/images/logo.png has a different background color than the depot.css sets the top bar to.

2006-05-07
148SUGGEST

A reminder to run ‘rake db:migrate’ might be worthwhile.

2006-05-07
159ERROR

The ‘authorize’ method should probably not be public; as written it creates a new action in every controller.

2006-05-07
161ERROR

In delete_user, render(:action => :list) should probably reference :list_users instead. Better yet, it should redirect.

2006-05-07
xiiTYPO

“far deeper that I’d expected” -> “far deeper than I’d expected”

2006-05-07
96TYPO

The reader is told to run the command:

depot> rake db:session:create

It should be

depot> rake db:sessions:create

2006-05-07
48SUGGEST

In the discussion of the :action parameter of the link_to method, the code in the rhtml file has double quotes around the action “goodbye” but the description has the action in single quotes. For someone totally unfamiliar, you should either use single quotes in both locations or double quotes in both locations in order not to confuse them.

2006-05-16
181TYPO

After the code listing: "Here we

2006-05-08
182TYPO

End of third paragraph: “… convenient way to refenece test data …” s/refenece/reference/

2006-05-08
182ERROR

Since the depot schema is now storing product prices as an integer, the fixtures should also reflect this.

2006-05-08
101OK

When editing add_to_cart.rhtml, item.title is not correctly changed to item.product.title, causing an error upon page reload.

(Dave says: CartItem has a title method)

2006-05-07
187TYPO

assert_nil/assert_not_equal should be assert_nil/assert_not_nil

2006-05-08
59ERROR

In the sentence immediately before the “Configure the Application” title, you have a reference to another section that was not correctly expanded. sec.test.db.config on page ?? should reference the real location.

2006-05-07
195TYPO

Under assert_tag :content, "

2006-05-08
127TYPO

Change ‘iterm’ to ‘item’ (First paragraph)
—-
“Click to add an iterm to the cart,”

Should be,

“Click to add an item to the cart,”

2006-05-07
127TYPO

Replace ‘and’ with ‘a’ (Forth paragraph)


"…the whole sidebar redraws on the transition between and cart that

2006-05-07
125TYPO

“ClassItem” should be “CartItem”

2006-05-07
59SUGGEST

I really think you should encourage people to not connect to mysql as the root user with no password. It is relatively easy to create a user to use with the depot databases that has all the permisions it needs. For instance, after the line that creates the development database you could have the following lines:

depot> mysql -u root -p mysql
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON depot_development.*
-> TO ‘depot_user’@‘localhost’
-> IDENTIFIED BY ‘agile_shopper’;
mysql> quit

This creates the user that only has access to this database when connecting from the localhost. Tell the users to update database.yml with the user and password. Also warn them that the database.yml file that is generated does not have a space after the : for the password field for the development and test databases. This space is required. The password field for the production database does have a space already.

By recommending this, people will not get into the habit of using the root user without a password. We do not want a repeat of the type of break-in that occured to the apache.org web site which was accomplished by attacking the site through its connection to mysql using the root user and no password.

(Dave says: it’s a tradeoff: do that, and folks tie themselves into knots as we proceed. Instead, I’ve added an addiitional warning)

2006-05-07
71TYPO

It the paragraph describing 002_add_price.rb, the word “featutes” should be “features”.

2006-05-07
111TYPO

The sentence: She notices a minor things … is obviously not right.

2006-05-07
113TYPO

The sentence: Rather that use …
should be: Rather than use …

2006-05-07
113TYPO

The sentence: Again, we’ll rely of CSS to do …
should read: Again, we’ll rely on CSS to do …

2006-05-07
127TYPO

Refers to the _add_to_cart template. Since this is an .rjs and no longer a partial, the leading underscore should be removed.

2006-05-07
131TYPO

Replace “browsers” with “browser’s”.

2006-05-07
131TYPO

Fill in “Chapter xx of Pragmatic Ajax [?]” with the eventual values.

2006-05-07
508SUGGEST

would be nice to see some real world examples like in the first book. i think you’ve got a lot to tell with all the 37 signals apps. ;-)

(Dave says: I’m not privy to 37s architectures… Ezra is writing a whole book on deployment, though)

2006-10-04
1TYPO

2nd last paragraph, “disovered” -> “discovered”.

2006-05-07
132TYPO

The database migration file for create_orders is numbered 004. However, if following the tutorial, it will be 005.

The create_line_items migration suffers from this same problem—it should be 006.

2006-05-22
7TYPO

Third bullet:
We use JavaScript effects, Ajax,and RJS

should be “Ajax, and”

2006-05-07
104TYPO

"which wasn

2006-05-07
24TYPO

The locomotive URL runs off the side of the page (first line)

2006-05-07
139TYPO

In the code listing for checkout.rhtml, the first div is given an id=“depot-form”. However, in the CSS for this page, depot-form is referred to as a class rather than an id (as a “.” vs. “#”). This should be changed to either a class, or the depot.css file should be changed to refer to depot-form as an id.

2006-05-07
204ERROR

The code listing is missing a final ‘end’ to close the definition of regular_user.

2006-05-08
205TYPO

Next to last paragraph: “… (you can get to it in the instance variable integration_session is you really need to).” s/is/if/.

2006-05-08
206TYPO

Code listing, top of page: “open_sesion do |sess|” s/sesion/session/.

2006-05-08
206ERROR

The example code for ‘host’ is confusing and/or erroneous.

sess.host = fred.blog_per_user.com

I imagine there should be quote marks around the assigned value. But also, underscores are not technically valid in domain labels corresponding to host names. And finally, (as a general suggestion throughout the book) it is preferable to use the reserved top-level or second-level domains for all documentation examples (e.g. example.com) rather than a live (or potentially live) domain. See RFC 2606.

2006-05-08
208TYPO

Next to last paragraph: "Let

2006-05-08
19SUGGEST

It would make more sense if “starting out with the difficult stuff” read “starting out with the easy stuff”.

2006-05-07
19OK

“Because Rails it just so easy” -> “Because Rails is so easy”

(Dave says: I’m happy with the idiom)

2006-05-07
90TYPO

In the last paragraph, second sentence, it starts with 2 “the”s.

2006-05-07
125TYPO

The first ‘is’ in ‘Whenever an item is the cart is updated’ is a typo.

2006-05-07
466TYPO

Under the description for @sent_on: “ATime object …” s/ATime/A Time/.

2006-10-04
5TYPO

Line 1 : “a indication”> “an indication”

2006-05-07
316SUGGEST

On page 316, there is a “Joe asks” section saying how after_find and after_initialize would slow things down, so the Rails team agreed on increased performance.

However, this section does not make sense at this stage because we were not introduced to any differences in the after_find and after_initialize methods until a page later. In other words, I was momentarily left wondering, “…alright, they agreed on increased performance how?”.

It may be more beneficial to include this “Joe Asks” section after the text “Because of a performance optimization, the only way to define callbacks for the after_find and after_initialize events is to define them as methods.”

2006-07-21
60TYPO

There’s something wrong with the PDF. On this page most of the page makes the cursor really large and doesn’t allow me to select single lines of text with Adobe Reader 6.0.

(Dave says: I don;’t see this here wth either Acrobar or Preview. Anyone else see this?

2006-05-28
60ERROR

The last sentence that goes to the next page about there being more information in database.yml about PostgreSQL and SQLite isn’t true. My database.yml only contains information for mysql by default.

2006-05-07
62TYPO

"or if you

2006-05-07
64TYPO

"And once you

2006-05-07
64TYPO

"what

2006-05-07
79TYPO

Spacing in footnote is messed up.

2006-05-07
115TYPO

Both chapters 9 and 10 are labeled as task D

2006-05-07
117TYPO

Second line, first paragraph, find is mispelled. “Whenever you fnd …” should read “Whenever you find …”

2006-05-07
53OK

In the example loop 3.times do … the correct output should be:
Ho! without the html tag

2006-05-07
74OK

:only_integer should be false to allow float values

()Dave says: the price is an integer)

2006-05-07
374TYPO

There is a ‘return’ immediately into the ‘def verify_premium_user’ method, which seems like a typo.

2006-07-25
21TYPO

Line 2: “comamnds”> “commands”

2006-05-07
25ERROR

I don’t quite know how to categorize this one. The footnote says for Windows “editing your system properties and setting to 9.” Which doesn’t mean anything. I guess you mean to say “changing your \\HKLM\\Software\\Microsoft\\Command Processor\\CompletionChar registry value to 9”, and maybe mentioning XP enables it by default.

(Dave says: yes - there was a missing chunk in there)

2006-05-07
27SUGGEST

At the end of the Editors section, you say “learn a new feature each day.” I feel it should read “every day,” while the distinction in usage is fairly subtle and somewhat subjective.

2006-05-07
109SUGGEST

While the footnote is already lengthy, you may want to suggest using OS X’s Console application where appropriate as a free alternative with a convenient clearing/updating

2006-05-07
113SUGGEST

This is somewhat snarky and more annoying than poignant:

Rather that use

  • elements for each item, let

  • 2006-05-07
    28TYPO

    (debatable) “100Mb of IDE” -> Be it HDD or RAM, you’ll talk in megabytes, not megabits, I guess. The proper abbreviation then is “MB”.

    2006-05-07
    102TYPO

    In the second to last paragraph, last sentence, you have “if” instead of “in”. It should read, “And, in fact, …”

    2006-05-07
    147SUGGEST

    Not all environments specify the correct ruby binary. The command should start with ruby: depot> ruby script/generate model user

    2006-05-07
    115TYPO

    In the third paragraph, fourth sentence, missing the word “the”. It should read, “… can interact behind the scenes with the application …”.

    2006-05-07
    117TYPO

    In the last paragraph, third sentence, you are missing the word “use”. It should read, “… the main template arranges to use a variable …”.

    2006-05-07
    123TYPO

    In the paragraph right after the code for add_to_cart.rjs, last sentence needs to be re-worded to something like, "… to use that HTML to replace the content of the

    with the id= of cart.

    2006-05-07
    123TYPO

    After making all the updates and reloading the store/index page and verifying that the correct HTML was generated and the javascript files loaded, the AJAX cart still didn’t work and the developer.log file had the following error:

    ArgumentError (undefined class/module Cart):

    Stopping WEBrick and restarting it caused this error to go away. You might want to mention this in the troubleshooting discussion as a way to make sure all the current code is loaded.

    2006-05-07
    124TYPO

    In the first paragraph of the section titled “The Customer’s Never Satisfied”, the fourth sentence, the work “now” is used instead of “know”. It should read, “… eager for the praise we know will come.”

    2006-05-07
    127TYPO

    In the second paragraph after the code fragment, second sentence, you have “reveals” instead of “reveal”. It should be, “… which will smoothly reveal the cart, …”.

    2006-05-07
    123TYPO

    Bottom of the page in the Troubleshooting section. First sentence “it can’t make (if) foolproof” (if) should read (it).

    2006-05-07
    131TYPO

    In the fourth bullet point, the word “change” needs to be plural. It should read, “To help the user see changes to the cart, …”

    2006-05-07
    136TYPO

    the line item cannot exist unless the correspond order and product rows exist.
    should be
    the line item cannot exist unless the corresponding order and product rows exist.

    2006-05-07
    134TYPO

    In the last paragraph, first sentence, it states that we are currently at version 3 of the database when we are actually at version 4. As mentioned in previous errata, the new migrations are numbered 005 and 006.

    2006-05-22
    138TYPO

    dealing with an object names “order”
    should be
    dealing with an object named “order”

    2006-05-07
    137TYPO

    In the third paragraph, third sentence, you have the word “the” instead of “then”. It should read, “… into the form fields, and then extracting …”

    2006-05-07
    138TYPO

    In the fourth paragraph, last sentence, the word “automatically” is mispelled. The sentence should read, “… it is automatically associated …”

    2006-05-07
    138TYPO

    In the fifth paragraph, second sentence, you have the word “need” instead of “needs”. It should read, “It’s important to remember that Rails needs to know …”

    2006-05-07
    4ERROR

    “…support for…mock objects” - unless it’s newly arrived in Rails 1.1, Rails supports stubs rather than genuine mock objects. You will remember this comment (from a number of people) from the first edition.

    2006-05-07
    1OK

    Most developers will probably recognize l33t speak, but some managers and other readers may not. You may want to add parenthetical definition.

    2006-05-07
    1OK

    The first page and a half do not read very well (not meaning to sound offensive). They seem like fragments gathered from various casual emails. The Intro read much more smoothly in the first edition.

    Many paragraphs are tied together so there is no clear logical break between them.

    “Rails went from being an unknown toy to being worldwide
    phenomenon.” would sound more “professional” as “Rails went from being a private experiment to being worldwide
    phenomenon.” The use of “toy” is not confidence inspiring.

    The use of “strong” language can be used to good effect occasionally, but you do risk offending some.

    As someone looking at various frameworks for a upcoming project, it would be nice to see more specific information comparing features of other frameworks (without bashing). Catalyst, Jifty, Maypole, PHP, Struts, etc. It would be considered flame-bait on mailing-lists, but I’ve seen it done well in books. It doesn’t have to bash, just compare features.

    The example code may not be a helpful illustration to beginners. A short paragraph explaining that the code describes the relationships of various data and sets up some constraints would help.

    I’m not sure the ChangeLog for the depot application is helpful to most readers-it is probably more confusing to first time readers than helpful.

    2006-05-07
    140ERROR

    The depot.css for .depot-form legend should specify font-family instead of font-style. The definition should be:

    .depot-form legend {
    color: #dfd;
    background: #141;
    font-family: sans-serif;
    padding: 0.2em 1em;
    }

    2006-05-07
    7967TYPO

    Small typo at first line of page: application writen as appplication.

    2006-05-07
    98OK

    In the add_to_cart method the product variable could be local as it’s not used in the view.

    product = Product.find(params[:id])
    @cart.add_product(product)

    Instead of:
    product = Product.find(params[:id]) cart.add_product(@product)

    2006-05-07
    27TYPO

    Near top of page, “And, once youve chosen an editor” - missing apostrophe in “you’ve”.

    2006-05-07
    33SUGGEST

    On this page you have body text saying what script/server does, a footnote explaining what WEBrick is, and a box at the top of the page saying that you might not get WEBrick after all. It’s a bit jumpy. Could you put the description of WEBrick in line, and the ‘exception’ regarding lighttpd in a footnote?

    2006-05-07
    30SUGGEST

    Keeping up to date also involves updating Rails files in your application.

    2006-05-07
    35OK

    Gratification could be substantially more instant if you generated the Say controller with the hello action (script/generate controller Say hello). Browsing http://localhost:3000/say/hello then shows a view that tells you where it lives (“Find me in app/views/say/hello.rhtml”).
    You would still show hand-addition of action and view when going on to “goodbye”. (For “goodbye” you could also demonstrate that the action method isn’t required - that Rails will go straight to the view with the same name if there’s no action method.)

    (Dave says: I thought hard about tis originally, but decided this flowed better, as it let me talk about URLs a bit)

    2006-05-07
    43OK

    Seeing dynamic content is great, but the reader may be immediately concerned about the displayed date/time format. This is a perfect opportunity to introduce a helper method.

    2006-05-07
    44SUGGEST

    “Why did we go to the extra trouble of setting the time to be displayed in the controller and then using it in the view?” - Fundamentally it’s because the Time instance is a model (although it’s not persistent, and we didn’t have to write the class for it), and it’s the controller’s job to provide the model for the view to display.

    2006-05-07
    63ERROR

    (Bottom of page) "If your file uses tabs, not spaces, to indent the lines following depot_devlopment: you

    2006-05-07
    104TYPO

    “automatically” is spelled wrong.

    "First, the cart and cart item classes weren

    2006-05-07
    122TYPO

    “Parameters” is misspelled.

    “This takes a hash of values that are the same as the trailing par meters we passed to button_to( ).” should be “This takes a hash of values that are the same as the trailing parameters we passed to button_to( ).”

    2006-05-07
    123TYPO

    is can be hard to check
    should read
    it can be hard to check

    2006-05-07
    149SUGGEST

    You mention that you want to create a private class method self.encrypted_password. Since the readers are probably new Ruby users, you should probably include the private statement in the source snippet. Also, you should mention that create_new_salt is a private method that should occur after the private statement.

    2006-05-07
    150SUGGEST

    When reviewing the code for user.rb, there are two items in the source that were not mentioned in the discussion. The first is the need to require digest/sha1 for the encription done in encrypt_password. It should probably be mentioned in the discussion for this method. The second is the definition of safe_delete. Once again, if it is going to be in the source, it should probably be discussed somewhere.

    2006-05-07
    113OK

    While I realize inject is likely to be covered in an appendix on basic ruby techniques, as with the first edition, a breakdown of why this was chosen here and its particular mechanics would be a welcome addition.

    (Dave says: tough call. I think I’d rather not break the flow here)

    2006-05-07
    121TYPO

    2nd line from the bottom should be read “open up index.rhtml” instead of “open up store.rhtml”.

    2006-05-07
    160TYPO

    In app/views/layouts/admin.rhtml, the closing paragraph tag for the link_to “Products” link should be

    instead of

    2006-05-07
    59TYPO

    At the very top of the page:

    work> cd depot
    work> ls -p

    After changing to depot, the prompt should change to depot> (as it does in the next prompt later on the page)

    (Dave says: good catch!)

    2006-05-07
    134TYPO

    In the command line output on this page, you have typed “rake db:migrate” twice:

    depot> rake db:migrate
    dave[code/depot_p 14:41:34] rake db:migrate

    It should be either one or the other. Judging by the examples in the rest of the book it should be the first.

    2006-05-07
    63TYPO

    (bottom of page) “…to indent the lines following depot_devlopment: …”
    There’s a typo in the name of the database: “depot_devlopment” instead of “depot_development”

    2006-05-07
    64SUGGEST

    You say:

    In reality, database connections work like a charm 99.9% of the time.

    I know you mean to be encouraging, but it could actually be discouraging to a developer who sometimes has database issues… and let’s face it, that is not 1 developer out of every 1,000.

    If things really worked well 999 times out of a thousand, would you have included a whole page with 10 possible errors to check? Each of those errors would only come up an average of 1 out of every 10,000 times! So maybe once among your readership. At that rate, you could include a warning just to me about my sticky up arrow key.

    Awesome book. I am having a blast.

    (Dave says: very good point)

    2006-05-07
    65TYPO

    (Middle of the page) " and with the file extension (..rb, because it’s a ruby program)"
    There’s is two dots in the extension name: “..rb”

    2006-05-07
    161TYPO

    You give an example implementation of delete_user that has some problems. You talk about the problems, which is good. However, after discussing the problems, you do not give a revised implementation of delete_user. You can look at the login_controller.rb listing on pages 537-538 to get the final implementation but it would probably be better to include it here.

    2006-05-07
    40ERROR

    At the very bottom of the page you say that the code will output the time zone as “CST” When I run this code locally it prints out the full time zone name, as in “Central Standard Time”

    (Dave says: I double checked, and I see the abbreviation)

    2006-05-07
    66SUGGEST

    You say “This uses a new command, rake.” but you did already use it earlier to test DB connectivity

    2006-05-07
    108TYPO

    The current text reads “is the exception is thrown” and I believe it should read “if the exception is thrown”

    (If instead of is…)

    2006-05-07
    130TYPO

    To do that, let

    2006-05-07
    78TYPO

    (Middle of the page) “the code generated by the scaffold is indentical to”
    Change “indentical” to “identical”

    2006-05-07
    82TYPO

    (Middle of the page) “(dropping the .css extension.”
    The closing bracket is missing or the opening bracket needs to be replaced by a comma

    2006-05-07
    113ERROR

    The definitions for empty_cart and redirect_to_index should match the code listing on page 539. In particular, the redirect_to_index method is used throughout the book with an optional message which does not work with the definition on page 113.

    (Dave says: it doesn’t need it at this point. That’s added later)

    2006-05-07
    125TYPO

    “let’s flash it’s background” should read “let’s flash its background”

    2006-05-07
    168ERROR

    In creating a Rest Interface, you should preface the “script/generate controller info” command with “ruby” since you cannot count on the #! line in script/generate to be right.

    2006-05-08
    178TYPO

    (First line) “when we created the development databases for the Depot application”
    “databases” should be singular

    2006-05-08
    179SUGGEST

    (Middle of the page) “We can use the model’s valid?() method to check to see if it validates”

    IMHO we have to choose between “to check” or “to see” :)

    2006-05-08
    181OK

    (First line) “and we verify the error message associated with the price attribute is what we expect”
    should be “and we verify that the error message”

    2006-05-08
    184TYPO

    (Using Fixture data: second paragraph) “However, Rails makes it easier that that”
    replace the first “that” by “than”

    2006-05-08
    188TYPO

    (Paragraph just before 13.3) the phrase “but these tend be be used infrequently used” should be replaced by “but these tend to be infrequently used”

    2006-05-08
    189OK

    (Middle of the page) “Rails is populating a response object behind the scenes.”
    “scenes” should be singular

    (Dave says: this one I’ll leave to the copt editor…)

    2006-05-08
    80ERROR

    in the listing for list.rhtml, the line to destroy an entry is written like this:
    <%= link_to ‘Destroy’, { :action => ‘destroy’, :id => product },
    :confirm => “Are you sure?” %>

    This doesn’t work. I think it should be (going by the default scaffolding created by rails) like this:

    <%= link_to ‘Destroy’, { :action => ‘destroy’, :id => product }, :confirm => ‘Are you sure?’, :post => true %>

    (Dave says: This is a change to scaffolding in 1.1.1. Fixed)

    2006-05-16
    195TYPO

    The following occurs twice in a row on the page; I think either it is a duplicate line that needs to be removed, or the second line is supposed to be different, but was not editted to reflect this:

    assert_tag(conditions)
    assert_tag(conditions)

    2006-05-08
    80SUGGEST

    It’s not immediately clear what the full URL for the images or for the depot.css file mentioned in the footnote is. In fact, I haven’t been able to find the images yet.

    2006-05-07
    209TYPO

    First paragraph of the page, last sentence is:

    "We

    2006-05-08
    199SUGGEST

    The script/generate command should be preceeded with “ruby” since you can’t count on the #! line to be correct

    2006-05-08
    31SUGGEST

    For ISP’s you could suggest people look at the following page as a starting point

    http://wiki.rubyonrails.com/rails/pages/RailsWebHosts

    2006-05-07
    30TYPO

    In the keeping up to date section, after the gem update command. It might be a good idea to suggest using “gem cleanup” or whatever that command is. It took me a while to learn about this and I had many gem versions sitting on my computer. This made the first html page of the gem documentation cluttered with all sorts of versions.

    (oops, posted this under page 41 as well which was wrong.)

    2006-05-07
    48SUGGEST

    Let

    2006-05-07
    48SUGGEST

    The brief discussion of what symbols are does not help me understand them. I have read the discriptions of symbols in Pickaxe and AWDWR and still do not have a real idea of what they are. I’m sure many programmers like me are coming from languages without a symbols analogy. I would love it if you spent a little more time on what symbols are and how they relate to strings. I know this is not a Ruby book but Rails uses symbols all the time and I feel a little whimpy without an intuative understanding of symbols.

    2006-05-07
    67OK

    “scaffold :product” You refer to this as a scaffold declaration. The word delaration is not really appropriate. It makes me think “int a;”. This is a call to the scaffold method, just a plain old Ruby method. It could be written as “scaffold(:product)”. This same type of thing confused me for a while with “has many :employees” or “validates_presence_of :name”. I didn’t know these were just plain old Ruby methods. I thought they were some sort of Rails voodoo. Perhaps you could write something like “This is just a call to the scaffold method provided by the Rails framework. It could be written as scaffold(:product)”

    (Dave says: I’m thinking that’s too much detail at this point)

    2006-05-07
    209TYPO

    In the second paragraph, third sentence, you have the word “valud” instead of “value”. It should read, “… if we pass 0 as the id value to MySQL…”.

    2006-05-08
    64TYPO

    “you can define database migrations..”. Then phrase ends with two dots.

    2006-05-07
    66SUGGEST

    The info:
    Rake looks for all the migrations not yet applied to the
    database and applies them.
    How do you know which migration has not yet been applied? I’d find this useful to know at this point.

    2006-05-07
    123TYPO

    then replace it

    2006-05-07
    177TYPO

    the code in the auto-generated product_test.rb should read “fixtures :products” instead of “fixture :products”

    2006-05-08
    125TYPO

    Whenever an item is the cart is updated (either when it is added or when we change the quantity) let

    2006-05-07
    149TYPO

    the text:
    to validate you typed what you thought
    you typed?
    There appears to be a typo here.

    2006-05-07
    108TYPO

    “instructs the browser to immediate request the URL …” ‘immediate’ should be ‘immediately’.

    2006-05-07
    125TYPO

    “In then fades back” should be “It then fades back” on the first line of text.

    2006-05-07
    136OK

    _cart.rhtml on this page uses the older button_to instead of form_remote_tag code we replaced button_to with earlier in the book.

    (Dave Says: I don’t see a prior _cart.rhtml using form_remote_tag. What am I missing?)

    2006-05-07
    126ERROR

    It seems that implementing the AJAX “Add to Cart” does not deal with the “Your cart is currently empty” flash if you had previously emptied your cart. Since there isn’t a form post (due to using AJAX) the flash stays on the screen even when you clearly have items in your cart. Being new to Rails I don’t know the proper solution but I “fixed” it by adding page[:notice].hide to my add_to_cart.rjs. I recognize that as a quick fix and probably not the most appropriate but I’m still learning Ruby and Rails.

    2006-05-23
    108TYPO

    Change “you access the flash as it it were a hash.” to “you access the flash as if it were a hash.”

    2006-05-08
    10SUGGEST

    The anchor to figure 2.1 redirects to the text below 2.1. It would be nice to be redirected to the top of the page (top of figure 2.1) there, to have the figure displayed when clicking on the reference to it. (instead of being thrown to the subtitle of the figure and having to scroll up)

    (Dave says: Sorry, not much I can do about this—the link is to the caption)

    2006-05-22
    107TYPO

    “A flash is a bucket (actually closer to a Hash), Into which you can store stuff as you pro-cess a request.”

    Probably better as:

    “A flash is a bucket (actually closer to a Hash), in which you can store stuff as you pro-cess a request.”

    2006-05-22
    131TYPO

    In second to last paragraph, “track done what changed” should be “track down what changed”.

    2006-05-22
    125TYPO

    "an

    2006-05-22
    1OK

    At source code file, “depot_final” folder doesn’t have all migrations files.

    (Dave says: depot_final isn’t code referenced from the book: I use it as a placeholder. depot_r is the latest ‘real’ version’)

    2006-05-09
    105OK

    "If we were rolling the Depot application into production, we

    2006-05-09
    131TYPO

    2nd to last line on page “I have JavaScript enabled in oe…” should read “I have JavaScript enabled in one…”

    2006-05-22
    86SUGGEST

    in the store index.html view you include the following code:

    <% for product in @products -%>

    There is no indication into why you end the code with a minus sign. Is this a special erb thing, or is it part of your code? It’s not obvious :-)

    It might be an interesting idea to write the excerpt as ruby code, with comments to where you want the output to go e.g. something like (I know this isn’t that correct..):

    for product in @products
    #choose css class
    #output image
    #output product title
    #output product description
    #output product price with css class price
    end

    which would allow the reader to get a good feel for the structure of the code before all the clutter of the html is added.

    2006-05-16
    120TYPO

    I don’t understand your explanation, Dave. You say:

    “I shows the updated version of redirect_to_index instead”

    Where in the book is this updated? Here’s the code on this page:

    def add_to_cart
    begin
    product = Product.find(params[:id]) rescue logger.error("Attempt to access invalid product #{params[:id]}") redirect_to_index("Invalid product") else cart = find_cart
    cart.add_product(product)
    redirect_to_index
    end
    end

    One version of redirect_to_index is taking an argument, one isn’t. Throws an error for me.

    2006-05-22
    160SUGGEST

    In last paragraph, it mentions adding the layout directive to the login controller. We’ve already done that on p. 153, but the text makes it sound like it’s the first time we’re learning about this. I like the idea of reiterating the point with additional background info, but perhaps an acknowledgement that the layout directive should already be in the code would make it clearer.

    2006-05-22
    161SUGGEST

    Should the link_to for delete_user be a button_to instead?

    2006-05-22
    73SUGGEST

    “You might…when developing.” The end of paragraph 6.2 has already stressed this point, so this seems superfluous.

    2006-05-16
    113SUGGEST

    Just a consistency point.

    In add_to_cart.rhtml you use the variable `cart_item` as a placeholder for all the cart_items in the cart:

    <% for cart_item in @cart.items %>

    yet on page 99 you use `item` as the variable name:

    <% for item in @cart.items %>

    Is there any real reason for this? If not it might be nice to keep them the same - either one is nice, although I personally prefer the more verbose `cart_item`. :-)

    2006-05-22
    80SUGGEST

    It might be useful to clarify what %{} does.

    2006-06-12
    87TYPO

    “Figure 7.1 .” There’s a leading space before the dot.

    2006-05-29
    89TYPO

    “on page ??.)” The closing paranthesis was never opened.

    2006-05-22
    89TYPO

    “Figure 7.2 .” There is a leading space before the dot.

    2006-05-29
    101ERROR

    <%= item.title %> should probably be <%= h(item.title) %> as in the index view. Same goes for later listings of the add_to_cart view.

    2006-05-22
    132TYPO

    The title should not be task D: Checkout but task E: Checkout…

    2006-05-22
    136TYPO

    2nd paragraph:

    Just what to these various declarations do? -> Just what do these various declarations do?

    2006-05-22
    118SUGGEST

    “Remember how the render with the collection option inside the add_to_cart template set the variable cart_item inside the partial. It turns out we can do the same when we invoke a partial.”

    This is rather a complicated couple of sentences. Would it be possible to break them down into more digestible chunks? Something like the following would be nice:

    Remember the ‘render with collection option’ that we used inside the add_to_cart template? That render option set the variable cart_item inside the partial for us automatically. It turns out we can also do this explicitly when we invoke a partial.

    2006-05-22
    119SUGGEST

    I like your use of an arrow to indicate the new part of the code. However it only seems to be pointing to the line:

    <%= render :partial => “cart”, :object => @cart %>

    when in fact this whole section is new:

    <%= render :partial => “cart”, :object => @cart %>

    Maybe there should be an arrow for each line,

    ->

    -> <%= render :partial => “cart”, :object => @cart %>
    ->

    or the arrow should somehow indicate a range of lines:

    (let’s pray this formatting works….)

    —>

    —-| <%= render :partial => “cart”, :object => @cart %>
    —>

    2006-05-22
    125TYPO

    The object name is incorrect in the last paragraph, sentence 5. "Let

    2006-05-22
    126ERROR

    Another code inconsistency.

    Your code in the _cart_item.rhtml partial references what looks like an older version of the `format_price` helper. The example given on page 126 is as follows:

    <%= cart_item.quantity %>×

    <%= cart_item.title %>

    <%= number_to_currency(cart_item.price/100.0) %>

    <%= cart_item.quantity %>×

    <%= cart_item.title %>

    <%= format_price(cart_item.price) %>

    2006-05-22
    128SUGGEST

    In your example add_to_cart.rjs you wrote:

    page[:cart].replace_html :partial => ‘cart’, :object => @cart

    -> page[:cart].visual_effect :blind_down if @cart.total_items == 1

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

    placing the arrow on the centre line indicating that it was new. You haven’t indicated why you place this blind_down effect between the other two statements. Is order important here? Otherwise why not put it at the end?

    2006-05-22
    120ERROR

    Looks like redirect_to_index(message) maybe should be rewritten as redirect_to_index(message=nil). Otherwise if you call redirect_to_index without any argument as you do on this page, you get a missing argument error.

    2006-05-22
    98TYPO

    The text after the index.rhtml code suggests using <h …> regularly, but the code itself uses the h(…) construct. It’s easy to figure out what’s going on, but the discrepancy made me go back and re-read the text and try both methods to confirm that one or the other wasn’t a typo.

    2006-05-22
    314ERROR

    Maybe I missed it, but I think the “dont_destroy_dave” method got removed from the Depot application: I worked through the whole thing and never added that code. The text says that we’ve already seen this callback in action, which I think got removed.

    (Dave yes: yes—you’re reading a version 1 chapter here)

    2006-06-12
    135TYPO

    “To do this, we use the belongs_to( ) declaration twice the line_item.rb file.” at the bottom of the page doesn’t seem to make sense.

    Looks like there’s a missing ‘in’:

    "To do this, we use the belongs_to( ) declaration twice IN the line_item.rb file.

    2006-05-22
    137SUGGEST

    I struggled to understand some of the concepts presented on this page:

    “As this form will have to link back into a Rails model object,”

    I don’t quite understand what this means, it assumes that I know why the form links to a model object. I guess it means that the data captured by the form will be manipulated within Rails by a model object, but I’m not sure.

    “However, consider the general case. Maybe we want to edit an existing model. Or maybe the user has tried to enter an order, but their data hase failed validation. In these cases, we want any existing data in the model shown to the user when the form is displayed.”

    This section required a number of re-reads before I understood that it was talking about auto-populating the form with existing model data. To me it would make sense that you introduce the concept and then explain why it is useful:

    We also might want to auto-populate a form with existing model data. There are a couple of reasons for this. Firstly, we might want to create a model with default values, and have these values visible when the form first loads. Secondly, the user might have tried to enter an order, but their data failed the validation procedures, and on reloading the form we don’t wish to lose the information they have already entered.

    2006-05-22
    138SUGGEST

    "However, simply knowing the name of the object isn

    2006-05-22
    141SUGGEST

    "Before we move on to that new action, though, let

    2006-05-22
    157SUGGEST

    We are told to edit the index, but that action was not specified when we generated the login controller.

    “The template is in the file index.rhtml
    in the directory app/views/login.”

    2006-05-22
    80ERROR

    In the code listing for depot_c/db/migrate/003_add_test_data.rb,
    the definition for self.down begins before self.up ends. In other words, it should read:

    1. . . .
      end

    def self.down
    Product.delete_all
    end

    2006-05-16
    123ERROR

    Using Rails 1.1.2, I couldn’t get the add_to_cart.rjs to work as written:
    page[:cart].replace_html :partial => ‘cart’, :object => @cart

    It did work when I changed to
    page.replace_html ‘cart’, :partial => ‘cart’, :object => @cart

    (Dave says: I checked here, and with the core team. The first form should work with 1.1.2)

    2006-05-22
    153SUGGEST

    “It falls through to the end, and renders the form associated with add_user”

    would it not be clearer to say that it renders the view associated with add_user?

    2006-05-22
    181SUGGEST

    you’re passing more than one parameter to the assert statement:

    assert product.valid?, product.errors.full_messages

    yet you don’t explain what these parameters do. It would help a lot if you could spend some time explaining the various assert statements, and the parameters they can take. :-)

    2006-05-28
    184TYPO

    Testing the Cart: fifth paragraph “…a cart, it check to see” -> “…a cart, it checks to see”

    2006-05-22
    89OK

    Perhaps you should note that ‘@content_for_layout’ has been deprecated in favor of ‘yield’?

    Dave says: Actually, it hasn’t. Marcel mispoke in the blog entry.

    2006-05-16
    202SUGGEST

    assert_success() is deprecated so it should not be used anymore…

    in my case it’s located in /actionpack-1.12.1/lib/action_controller/deprecated_assertions.rb

    2006-05-22
    80OK

    When I did this, the scaffolding generated code using

    @products_pages

    not

    @product_pages

    (Dave says: Perhaps you typed ‘products’ on the command line?)

    2006-05-16
    115-131SUGGEST

    Throughout this section (Task D) of the tutorial, “Empty Cart” button remains untouched. This seems to be a serious deficit in our application, as it can leave the notice “Your cart is currently empty” and have the content of the cart shown in the side bar. This problem should become clear quite early (as early as at the end of the iteration D2). I suppose you can “leave it as an exercise for the reader”, but at least you should acknowledge this shortcoming.

    2006-05-22
    209TYPO

    "we

    2006-05-22
    187SUGGEST

    As well as having a description of the asserts, would it be at all possible to have simple examples of them?

    2006-08-27
    76OK

    validates_format_of :image_url,
    :with => %r{\\.(gif|jpg|png)$}i,
    :message => “must be a URL for a GIF, JPG, or PNG image”

    running the browser shows:

    app/models/product.rb:14: parse error, unexpected $, expecting kEND

    Line 14 is the regex line.

    No idea what the correction is. I’m stuck?

    (Dave says: I don’t see that problem here: are you running the code downloaded from our site, or did you type it in? If the latter, I suspect a typo)

    2006-05-22
    19TYPO

    It’s not the idiom of “Rails it just so easy”, it’s the typographical error: “is”, not “it”.

    2006-05-22
    127TYPO

    Change
    […]
    cart only appears with it has some content?
    to
    […]
    cart only appears WHEN it has some content?

    2006-05-22
    189SUGGEST

    you include login_controller_test.rb, yet you don’t include everything. In my stub i have the following extra lines:

    1. Replace this with your real tests.
      def test_truth
      assert true
      end

    It would be great if you could either mention that the actual file has more lines, or include them (my preference would be the latter).

    2006-05-22
    190SUGGEST

    “depot> ruby test/functional/login_controller_test.rb -n test_index”

    is there any chance that you could briefly explain what you’re doing here with the -n flag, and why you need to pass it test_index?

    2006-05-22
    141TYPO

    Footnote 5, first sentence.
    “…, given that it’s value comes ….” should read
    “…, given that its value comes ….”

    2006-05-22
    136TYPO

    It’s late and maybe I’m being dumb, but I don’t get this sentence:

    We

    2006-05-22
    96ERROR

    Next to the line
    # (create the session table with ‘rake create_sessions_table’)
    There’s a margin comment, “see if they update env.rb with new task names”

    They did. The line in my rails project is
    # (create the session table with ‘rake db:sessions:create’)

    2006-05-22
    131OK

    Isn’t content_for_layout being replaced by yeild?

    - <%= @content_for_layout %>
    + <%= yield %>

    (Dave says: no)

    2006-05-17
    108SUGGEST

    after rake db:session:create, I had to rake db:migrate to let the changes make effect. Didn’t see this in the book.

    2006-05-22
    147TYPO

    Iteration F1 should be E1, etc. now that chapter is renamed Task E: Administration.

    2006-05-23
    116OK

    Technically speaking, a Ruby method isn’t invoked. Instead, a message is sent to an object which may be handled by a method. Because Ruby takes this to the extreme, it may be worth mentioning to Nuby’s lest they gasp at the missing 1-to-1 link present in so many other languages.

    (Dave says: that’s really just semantics: a method is indeed invoked, and the message sending metaphor (which I believe I introduced in the PickAxe) is actually more confusing than not to newcomers)

    2006-05-17
    119SUGGEST

    <%= render :partial %> or <%= render(:partial) %> (see preceding pages)? Sticking to one notation would help overall consistency.

    2006-05-22
    123TYPO

    “(using javascript_include_tag?” misses closing paranthesis

    2006-05-22
    126TYPO

    “methdod” should read “method”

    2006-05-22
    129SUGGEST

    Another note on consistency: this is the first time that I’ve seen you use single-quoting, which may strike some readers.

    2006-05-22
    131TYPO

    “facailities” should read “facilities”

    2006-05-22
    133TYPO

    The URL to the ActiveMerchant library isn’t hyperlinked.

    2006-05-22
    150TYPO

    “of the form_for, it is automativally associated with the data”

    automativally = automatically.

    2006-05-22
    11TYPO

    It is not "Tous les jours,

    2006-05-22
    39TYPO

    once youve chosen an editor => should read once you have chosen or once you’ve chosen

    2006-05-16
    153OK

    if request.post? and user.save flash[:notice] = "User #{user.name} created"
    @user = User.new
    end

    should be

    if request.post? and user.save flash[:notice] = "User #{user.name} created"
    else
    @user = User.new
    end

    (Dave says: no, this way it lets you create multiple users)

    2006-05-22
    126OK

    Well, I figured out one way to ensure the hiding of the “Your cart is currently empty” flash message when a customer adds a book to the cart. Be sure to add the “page[:notice].hide” line Jason suggested to the add_to_cart.rjs file (see comment above) AND modify the store.rhtml file in the layouts directory. Add the two lines indicated below:

    <% if flash[:notice] -%>

    <%= flash[:notice] %>

    add-> <% else %>
    add->

    <% end -%>
    <%= @content_for_layout %>

    This ensures that the application will work the first time a user adds a book to the cart, bypassing the error I mentioned earlier. I would have preferred to add an if clause to the .rjs file, but nothing I tried worked. Any suggestions?

    (Dave says: Yup: look at the end of the checkout chapter for an example.)

    2006-05-23
    75OK

    In the footnote (6) from the previous page you say "With other databases, the value might come back as a string, so you

    2006-05-22
    162TYPO

    just deleted the only administrative used from the system
    should be
    just deleted the only administrative user from the system

    2006-05-22
    81ERROR

    The scaffold-generated controller code requires a POST to destroy content, but your sample list.rhtml code generates a GET URL. It took me a while to figure out why it was silently not deleting the table entries.

    2006-05-16
    131TYPO

    And, as we saw, startign with a conventional application mkes

    should be “…starting… makes”

    2006-05-22
    137TYPO

    but their data hase failed validation

    2006-05-22
    156SUGGEST

    in the login action of login controller, how to redirect to the original referrer?

    i.e. when try to access “admin/list” I should be taken to “login” and back to “admin/list”

    If I login from “login/login” then I should be taken to the list?

    I have stored the original referrer information in session and used this information to redirect. But the code looks ok…is there a better way?

    2006-05-22
    67TYPO

    In paragraph starting “Using your favorite editor..” file admin_controller is referenced without extension “.rb” - extension should be there for clarity.

    2006-05-22
    73SUGGEST

    In the footnote: “Remember.. cents..” Actually, I don’t remember any mention of the price being stored in cents. Either point this out when the column is added or motivate here why you want to use cents rather than dollars. [cents will not allow micro payments, though :-)]

    2006-05-22
    114TYPO

    Hmmm…let

    2006-05-22
    92TYPO

    “See the discussion starting on
    page 380 on page ?? for some more background” -> on page is repeated.

    2006-05-22
    209ERROR

    class OrderController; def rescue_action(e) raise e end; end

    should be;

    class StoreController; def rescue_action(e) raise e end; end

    2006-05-22
    1TYPO

    ORIGINAL:
    Rails went from being an unknown toy to being worldwide
    phenomenon.
    CORRECT (Change between <<>>):
    Rails went from being an unknown toy to being <> worldwide phenomenon.

    2006-05-22
    108TYPO

    It allows us to specify one path through the action is the exception is thrown, and other if it isn

    2006-05-22
    136TYPO

    “delcarations” should read “declarations”

    2006-05-22
    553ERROR

    The “depot-form” selectors should be IDs instead of classes for them to work properly (at least in Firefox). i.e. replace all occurances of “.depot-form” with “#depot-form”.

    2006-05-23
    146TYPO

    Underneath “What We Just Did”, the first bullet item has a trailing dot but the second and third haven’t. Also, “we did the following” might use a trailing colon instead of a dot.

    2006-05-22
    79TYPO

    ORIGINAL
    It turns out that we can: migrations to the rescue.
    Problem:The colon next to can isn’t right.

    2006-05-22
    151SUGGEST

    There’s a fair bit in here that wasn’t in the previous pages. safe_delete wasn’t introduced before, nor were create_new_salt and encrypted_password declared private.

    2006-05-22
    163ERROR

    The code for safe_delete is already shown on PDF page 151, so the user may have typed this in already meaning that they wouldn’t be able to delete the last admin.

    2006-05-22
    126SUGGEST

    “rendering is the one that was just changed.” -> “rendering is the one that just changed.”

    2006-05-22
    153TYPO

    "If it comes from an link, we

    2006-05-22
    166SUGGEST

    The first footnote in 12.1 could benefit from some pointers as the reader may also be interested in reading more about the mentioned four topics, namely SOAP/XML-RPC client/server.
    So we could have a few page numbers here.

    (Dave says: It’s likely we’ll be losing the web services chapter…)

    2006-05-22
    1TYPO

    ‘l33t’ on the 5th or 6th line. Perhaps it is just personal opinion, but l33tsp34k(leetspeak) doesn’t exactly reek of professionalism. I wouldn’t use it in an official email, much less in a book; but that’s just me. :)

    (Dave says: ah, I don’t write that kind of book :)

    2006-05-22
    27TYPO

    Section “The Desktop”, final paragraph, fourth line from the bottom: s/can can/can/

    2006-05-22
    27SUGGEST

    Replace the “wicked which” in the next-to-last line: “a Ruby library that conntects”.

    2006-05-22
    20TYPO

    Line 5 from the bottom: s/50 Mb/50 MB/

    2006-05-22
    79TYPO

    The footnote begins with “Rather that”

    It should be “Rather than”

    2006-05-22
    120TYPO

    The spacing in the text below the screenshot is off. I see “The cart’s inthe sidebar” when it should be “The cart’s in the sidebar”

    2006-05-22
    138TYPO

    “with an object names ”order." " should be “with an object named ”order." "

    2006-05-22
    147TYPO

    depot> script/generate model user
    should be
    depot> ruby script/generate model user

    2006-05-22
    26SUGGEST

    In the list of editors, jEdit would be a good choice to include. With the addition of its SuperAbbrevs and Console plugins, jEdit can do a lot to help Rails developers be more productive. See, for example, http://saimonmoore.net/permalink/jedit-for-ruby-rails-development for details.

    2006-05-22
    24ERROR

    The locomotive link runs off the right side of the page and is outdated. I’m using Preview under Mac OS X 10.4.6.

    2006-05-22
    205TYPO

    “a use at a browser interacting” -> “a user at a browser interacting”

    2006-05-22
    182TYPO

    After test code, first sentence, "Here we

    2006-05-22
    1SUGGEST

    You may want to add a footnote about the text "It isn

    2006-05-22
    230SUGGEST

    While I don’t know if you’ve got plans to change this section I think the “You might be able to use the -s option when you run breakpointer to connect to an application on
    another machine.” is very vague. It would be nice to give a better explaination of why you “might” be able to.

    2006-08-24
    87TYPO

    “… sidebar on this public-facing pages.” should be “… sidebar on the public-facing pages.”

    2006-05-22
    113TYPO

    One extra period in sentence "We can implement one using Ruby

    2006-05-22
    39TYPO

    permentently => permanently

    2006-05-22
    67TYPO

    first line: appplication

    2006-05-22
    521OK

    Hashes and Parameter Lists

    Add a converse line of code to show a call made with a hash instead of showing one without.

    (Dave says: this call already shows a hash being passed)

    2006-10-04
    149SUGGEST

    Perhaps it might be worth mentioning that digest/sha1 is required for the snippet to work. Otherwise, users may overlook the require in the code listing later on.

    2006-05-22
    66SUGGEST

    Shouldn’t the database columns be set NOT NULL? After all, you do perform a validates_presence_of later on. (Same goes for all later migrations and database tables too.)

    (Dave says: possibly, but I wanted to keep it simple for now)

    2006-06-12
    147SUGGEST

    About the reference to Rails Recipes: it’d might be interesting to note why a reader would also consult RR when a fine authentication recipe is provided here already.

    (Dave says: because RR also has a role-based recipe)

    2006-05-22
    150SUGGEST

    It might make sense to rename the login action in user.rb to authenticate. Technically, no session login occurs and it also prevents confusion with the login action in the LoginController later on.

    2006-05-22
    27TYPO

    Aracho Ruby -> Arachno Ruby

    2006-05-22
    96TYPO

    The sentence “It you now look at the database…” should read “If you now look at the database…”

    2006-05-22
    96ERROR

    A previous errata already identified the typo for the session create command to correctly be

    rake db:sessions:create

    However, this only creates a migration file and does not automatically create the session table as the book implies. The session table only comes into existences once

    rake db:migrate

    is executed.

    2006-05-22
    60ERROR

    The cursor changes to a pointer finger when mousing over the top third of the page. The underlying link reference is invalid.

    (Dave says: Could someone email me a screenshot of this problem: I just dan’t see it here. dave at pragrog.com)

    2006-05-23
    61TYPO

    … if you’re decided to rebel …
    should be
    … if you’ve decided to rebel …

    2006-05-22
    64TYPO

    … once you’ve go Rails …
    should be
    … once you’ve got Rails …

    2006-05-22
    66TYPO

    … so that in looks like the following …
    should be
    … so that it looks like the following …

    2006-05-22
    117SUGGEST

    The explaination of how a partial assign an element of a collection to a variable is very confusing.

    "That

    2006-05-22
    163ERROR

    Shouldn’t we see the code that actually uses the safe_delete helper at this point?

    2006-05-22
    62ERROR

    The command “rake db:migrate” is failing with this error:

    No such file or directory - db/schema.rb

    Is it possible that we have to do “script/generate migration” before running that command?

    BTW,
    marklar:~/src/learn/agilebook/depot max$ uname -a
    Darwin marklar.local 8.6.0 Darwin Kernel Version 8.6.0: Tue Mar 7 16:58:48 PST 2006; root:xnu-792.6.70.obj~1/RELEASE_PPC Power Macintosh powerpc

    (Dave says: this is probably a database configuration issue, as it seems to work fine here)

    2006-05-22
    78OK

    the command “ruby script/generate scaffold product admin” terminates with the following error:

    No such file or directory - script/../config/../app/views/layouts/admin.rhtml

    The scaffolding seems to work, although the CSS stylesheet doesn’t seem to exist. I’ve been building the project by hand and there’s not app/views/layouts folder

    (Dave says: the ‘rails’ command creates it)

    2006-05-22
    97TYPO

    … for an array of atems. When …
    should be
    … for an array of items. When …

    2006-05-22
    107TYPO

    Section 8.3 is called Iteration C2 and Section 8.4 is also called Iteration C2

    2006-05-22
    68TYPO

    on the footnote where it reads “application from Chaptera 4.” it should read “application from Chapter 4.”

    2006-05-22
    121TYPO

    At the very botton, it should say “…open up index.rhtml in the app/views/store directory…”

    2006-05-22
    127TYPO

    see typo “…on the transition between and cart that’s empty”

    2006-05-22
    129SUGGEST

    In the first paragraph, the sentence “We’d use it in the store layout like this.” coupled with "For now, we’ll keep

    2006-05-22
    184SUGGEST

    Perhaps use ActiveRecord::Errors.default_error_messages[:taken] instead of “has already been taken” in the following line of code:

    assert_equal “has already been taken”, product.errors.on(:title)

    2006-05-22
    139SUGGEST

    Footnote says: “Rails provides good support for generating
    selection lists in this context too”. Maybe an example?

    2006-05-28
    55TYPO

    Second paragraph: There’s a spurious space character between the reference to “Figure 5.2” and the following comma.

    2006-05-29
    56TYPO

    Third paragraph: There’s a spurious space character between the reference to “Figure 5.3” and the following fullstop.

    2006-05-29
    63SUGGEST

    The list of possible errors of “rake db:migrate” should be extended for the message “No such file or directory - /tmp/mysql.sock”. On OpenSUSE (10.0), this file is /var/lib/mysql/mysql.sock. After setting a soft-link to /tmp, the DB test succeeds. (Answer found in the ROR wiki.)

    2006-05-28
    75OK

    I guess that your customer will bark at the “integer test” for the price after having to enter, say “2395” instead of “23.95”. How could she let this slip through Iteration A3?

    (Dave says: she was probably drunk)

    2006-05-23
    83TYPO

    First bullet point: We created a development database […] to access it.

    2006-05-28
    24OK

    The two links that appear on this page cross the margin right border. Also, the first line of the 3.4 section has grown to more than the width of the complete text area.

    (Dave says: all layout issues are address just before final printing)

    2006-05-28
    3SUGGEST

    Undefined acronym “RESTful”

    Also, ???
    - It turns out the best way
    + It turns out that the best way

    2006-05-29
    111TYPO

    duplicate word ‘on’
    "We

    2006-05-28
    191TYPO

    Footnote: Should “assert_directed_to()” be “assert_redirected_to()”?

    2006-05-28
    217SUGGEST

    Did I miss the step where DAVES_DETAILS was defined?

    2006-05-28
    141TYPO

    “Now for the template itself.”
    => “Now, for the template itself.”

    2006-05-28
    141TYPO

    “Maybe we want to edit an existing model. Or maybe the user has
    tried to”

    The sentence just ends and the next line begins mid-sentence.

    2006-05-28
    142TYPO

    “The first parameter, :order tells…”
    => “The first parameter, :order, tells…”

    2006-05-28
    241TYPO

    Section 15.1 - “allow them to be send” should be “allow them to be sent”.

    2006-05-29
    228TYPO

    “so after freezing your application …” should be “so after freezing, your application …”

    2006-05-29
    145SUGGEST

    "Let

    2006-05-28
    146SUGGEST

    In ‘Joe Asks…’ section.

    "Joe

    2006-05-28
    146SUGGEST

    “If the save succeeds, we delete the cart from the session ready for the next order and redisplay the catalog, using our redirect_to_index( ) method to display a cheerful message.”
    => “If the save succeeds, we do two things. First, we ready ourselves for this customer’s next order by deleting the cart from the session. Then, we redisplay the catalog using our redirect_to_index( ) method to display a cheerful message.”

    “If instead the save fails, we…”
    => “If, instead, the save fails, we…”

    (Dave says: much better wording. Thanks!)

    2006-05-28
    224SUGGEST

    Could you elaborate why components are considered deprecated? As a former Rails 1.0 user and buyer of Agile Rails 1.1 I am quite interested in the changes of the framework.

    (Dave says: I’ve added a section to Action Pack)

    2006-05-28
    224ERROR

    As I figured out the rake-rdoc is not generated for code living inside the lib/ directory. Maybe you could explain the reason for that (or give a solution to it)?

    (Dave says: It qwill include lib/ as of 1.1.3)

    2006-05-29
    224OK

    Is there a way to make classes or modules reloadable in development mode if they are located in the lib/ directory?

    (Dave says: I believe not)

    2006-06-12
    49TYPO

    In the rhtml:

    Time to say
    <%= link_to “GoodBye!”, :action => “goodbye” %>

    <<link_to “GoodBye!”>> s.b., <<link_to “Goodbye!”>>, to match the (correct) spelling elsewhere.

    2006-05-28
    56TYPO

    - Overspecify it upfront
    + Over-specify it up front

    (Dave says: I’ll let the copy editor worry about this one :)

    2006-05-28
    62TYPO

    In figure 6-1,

    - database: ttt_development
    + database: depot_development

    2006-05-28
    63TYPO

    - …you shound

    2006-05-28
    63SUGGEST

    - It should be the same as the name of the database
    you created using mysqladmin.
    + It should be the same as the name of the database
    you created using your database administration tool.

    2006-05-28
    64OK

    This sentence got scrambled with another:

    If you see the error Before updating scaffolding from
    new DB schema, try creating a table for your model (Product), it may well be because Ruby (and hence Rails) can

    2006-05-28
    60TYPO

    Footnote: s/ad nauseum/ad nauseam/

    2006-05-28
    90TYPO

    The reference to “Figure 7.1” has a spurious space character before the following fullstop.

    2006-05-29
    92TYPO

    The reference to “Figure 7.2” has a trailing space character before the following fullstop.

    2006-05-29
    73OK

    In the footnote, you said “Remember that we’re storing the price in the database in cents”, but I didn’t find any reference to that election before this page.

    (Dave says: It’s in the sidebar two pages befoee)

    2006-05-28
    74OK

    The footnote is splitted in two pages. Probably the best way is to have all the lines in the same page.

    (Dave says: we do layout at the end)

    2006-05-28
    41TYPO

    Normally, this doesn

    2006-05-28
    81OK

    If you didn’t stop the webrick server after adding “scaffold :product” line at the app/controller/admin_controller.rb file, the new list.rhtml view won’t be rendered, because webrick seems to use still old scaffold functions.

    (Dave says: seems to work OK for me. Does anyone else see this?)

    2006-05-28
    102TYPO

    “Rails complains. Let’s make it happy by writing…”

    2006-05-28
    79TYPO

    In "So far, the only code we

    2006-05-28
    243TYPO

    First paragraph: “adds some hhelper methods to strings” - “hhelper” should be “helper”

    2006-05-29
    227TYPO

    Last paragraph, first line. “…,you want want to consider…” should read “…, you may want to consider…”

    2006-05-29
    227TYPO

    Last paragraph, third line. “…, six months from they, …” should read “…, six months from now, …”

    2006-05-29
    229TYPO

    In section “Linking Your Project to the Rails Repository”, the last word on the line just below the code example “svn up vendor”: “From now one, …” should read “From now on, …”

    2006-05-29
    230ERROR

    Third paragraph in “Runtime Environments” section (and following command-line examples): "If you

    2006-05-29
    109TYPO

    The reference to “Figure 8.4” has a trailing space character.

    2006-05-29
    116TYPO

    Another trailing space after “Figure 8.5”.

    2006-05-29
    131TYPO

    …“The scipt.aculo.us effects library”…

    sc*r*ipt.aculo.us

    2006-05-28
    219TYPO

    duplicate then “It then then reopens the PaymentGateway” 7 lines from the end of the page.

    2006-05-28
    141SUGGEST

    The unexpected line break looks like you were looking at my suggestion for the previous edition:

    “However, consider the general case. Maybe we want to edit an existing model. Or maybe the user has tried to enter an order, but their data hase failed validation. In these cases, we want any existing data in the model shown to the user when the form is displayed.”

    This section required a number of re-reads before I understood that it was talking about auto-populating the form with existing model data. To me it would make sense that you introduce the concept and then explain why it is useful:

    We also might want to auto-populate a form with existing model data. There are a couple of reasons for this. Firstly, we might want to create a model with default values, and have these values visible when the form first loads. Secondly, the user might have tried to enter an order, but their data failed the validation procedures, and on reloading the form we don’t wish to lose the information they have already entered.

    2006-05-28
    115OK

    My suggestion was in the errata for the previous version, yet I can’t see any change, hence I’m suggesting it again. Ignore it if you think it’s too pernickity!


    ust a consistency point.

    In add_to_cart.rhtml you use the variable `cart_item` as a placeholder for all the cart_items in the cart:

    <% for cart_item in @cart.items %>

    yet on page 99 you use `item` as the variable name:

    <% for item in @cart.items %>

    Is there any real reason for this? If not it might be nice to keep them the same - either one is nice, although I personally prefer the more verbose `cart_item`. :-)

    (Dave says: I don’t see this: it seems consistent (cart_item) here. Please e-mail me if I’m missing something)

    2006-05-28
    150TYPO

    Just after, the hide the

    that contains the “flah” should probably be “flash”

    2006-05-28
    106OK

    I did not get the exception, “depressingly illustrated in Figure 8.2”, instaed everything just worked. The old session was apparently already deleted when restarting application.

    (Dave says: it wouldn’t be. Perhaps you hadn’t previously added something to the cart, in which case the session wouldn;t have out-of-date data)

    2006-05-28
    201TYPO

    In the “Assertions” list, this assertion appears:
    assert_response(type, message=nil)
    For consistency, this should probably simply read:
    assert_response(type, message)
    … with “message” in italics (like the other assertions in the list)

    2006-05-28
    165TYPO

    In line:

    redirect_to(session[:original_url] || { :action => “index” })

    “:original_url” should be “:original_uri”

    2006-05-28
    167TYPO

    line:
    redirect_to_to(:action => :list_users)

    should be:
    redirect_to(:action => :list_users)

    2006-05-28
    104TYPO

    In the add_product listing there is one extra ‘end’ which should be deleted

    2006-05-28
    130OK

    The RJS example should do a conditional page.hide on the flash #notice div if it exists, otherwise you add something to the cart and the “your cart is empty” notice is still there.

    Also it would be a good idea to discuss the fact that offloading the add_to_cart functionality into an RJS file breaks the app if javascript is turned off - instead of degrading gracefully, it renders the javascript onscreen in the browser.

    (Dave says: See later for both…)

    2006-05-28
    118TYPO

    … lets revisit out layout.
    to
    … lets revisit our layout.

    2006-05-28
    144ERROR

    The current CSS file in both the book and source files has the depot-form id set to classes, as in the following:

    .depot-form fieldset { … }

    The source code that is generated gives the depot-item div an id, not a class. I had to go and change the CSS file to reflect that the div contained an ID and not a class.

    (Dave says: I believe the latest edition has them as classes (except for depot_r’ add_user form, which I’ve fixed)

    2006-05-28
    83OK

    The code for the links to the Previous page and Next page is equivalent to, but different from, the scaffolding code that’s generated automatically. It should match, unless there’s a good reason not to (which should be mentioned in the text).

    (Dave says: I prefer to have shorter lines when I type stuff manually)

    2006-07-13
    81TYPO

    Footnote 9, to the images, results in a “Forbidden” page—I didn’t have access to the directory.

    2006-05-28
    89OK

    The find_products_for_sale method has “self.” in front of the method name, which is different from all other methods up to this point. Either it’s extraneous/wrong, or it should be explained.

    (Dave says: the annotation in the margin next to the example points to the explanation)

    2006-05-28
    225TYPO

    In 2nd paragraph you give example subdirectory lib/pdfstuff; after 4th paragraph the example of importing from that directory has an underscore: require “pdf_stuff/receipt_writer”.

    2006-05-29
    246TYPO

    * puts 20.minutes.until(“2006-12-25 12:00:00”.to_time)*
    I think that the word “until” should be blue.

    (Dave says: yes, it should, but our syntax coloring tool ain’t that smart… :)

    2006-06-12
    152SUGGEST

    About the footnote: it might be useful to elaborate why a reader should also take a look at Rails Recipes. Other than a shameless plug, what is the advantage on a technical level?

    Dave says: because it show role-based authenitcation, too)

    2006-05-28
    182SUGGEST

    Halfway the page, you mention unit and functional tests. It might be useful to also prepare the reader for the bit about integration tests.

    2006-05-28
    183SUGGEST

    Not actually a typo, but an ending colon after “The first is the line” might be appropriate.

    2006-05-28
    186TYPO

    “Let’s write the full test” misses an ending colon.

    2006-05-28
    164OK

    In the listing of depot_q/app/controllers/application.rb seems to be missing a return “false”:

    class ApplicationController < ActionController::Base
    private
    def authorize
    unless User.find_by_id(session[:user_id])
    flash[:notice] = “Please log in”
    redirect_to(:controller => “login”, :action => “login”)
    false # <—- HERE
    end
    end
    end

    Otherwise, the rendering of the page continues and and error is thrown

    (Dave says: From the documentation: "Additionally, it

    2006-05-28
    137SUGGEST

    When talking about foreign keys, suggesting this [http://www.redhillconsulting.com.au/rails_plugins.html] would be a good idea i think. Not sure why it isn’t part of rails anyway?

    (Dave says: I don’t like the way that plugin automatically adds constraints: I’d prefer always having to use :references. As to your second point: I agree)

    2006-05-28
    24SUGGEST

    An alternative to using package management on Linux could be ROROX (http://rubyforge.org/projects/rorox), which puts Ruby, Rails + dependencies + useful gems over a XAMPP (http://apachefriends.org/en/xampp.html) installation. It supports running Rails under SCGI within subdirectories of localhost, and supplies scripts for doing the necessary configuration. (I maintain the package, by the way.)

    (Dave says: this is very cool. I’ll include it if it seems to have traction in a year)

    2006-05-28
    82OK

    The testdata contains para tags which show up in figure 6.5 Tidied up Pruduct Listing (p.85).

    (Dave says: Tht is correct.)

    2006-05-28
    186SUGGEST

    The rest of book uses double instead of single quotes. For reasons of consistency it may be appropriate to stick to a single notation throughout the book.

    2006-05-28
    188TYPO

    “either Comma-Separated Value (CSV) format or YAML format.” The first “format” is superfluous.

    2006-05-28
    190TYPO

    “it’s title” should read “its title”

    2006-05-28
    190TYPO

    “compart” should read “compare”

    2006-05-28
    124SUGGEST

    "Remember that underneath the covers, button_to( ) generates an HTML

    ." Actually, this is the first time this is being explained. Not a big deal, but saying “Remember” implies that it’s been explained previously.

    2006-05-28
    161TYPO

    “This form is different to ones we’ve seen earlier” should be something like “This form is different FROM ones we’ve seen earlier”

    2006-05-28
    166TYPO

    the linked list_users.html is much different than the one in the PDF.

    (Dave says: sorry—that code didn’t get reuploaded)

    2006-05-28
    168SUGGEST

    call me a dummy, but when i saw that we were writing a “helper ” (safe_delete), i headed straight for the helpers folder. is “helper” a bad word choice here?

    2006-05-28
    229TYPO

    “These Rake tasks take a version … and freeze them …” Is that grammatically correct?

    2006-05-29
    119OK

    Last line of first paragraph plus footnote: “partial templates” and the associated footnote should be reformatted. I guess, what you want to have is something like: “\\textit{partial templates}\\footnote{Another way […], see section \\ref{sec.dont.use.components}, on page \\pageref{sec.dont.use.components}.)}.”
    (a) The fullstop after “partial templates” should go /after/ the \\footnote insertion.
    (b) “, on page …” should go /into/ the \\footnote.
    © The final sentence of the \\footnote should get a closing parenthesis.

    (Dave says: this is an artifact of the formatting system: it doesn’t like missing cross references in footnotes :)

    2006-05-28
    126TYPO

    Last line of the third paragraph from the bottom: Remove the space character between “HTML” and “.”.

    2006-05-28
    144TYPO

    Trailing space after reference to “Figure 10.1”

    2006-05-29
    73OK

    How do I add the price column in a different order (e.g. after the title)?
    I usually expect that one book can’t answer all my questions, but I really appreciate it when the author(s) add pointers to other references with more details, so I don’t have to spend days (sometimes weeks) looking for answers to questions I might have after reading a book.

    (Dave says: I don’t believe you can. I also don’t really see why it would matter..)

    2006-05-28
    75TYPO

    version of our code,x too.

    2006-05-28
    154OK

    Running this code gives me a “NoMethodError in Login#add_user”, undefined method ‘name’ for #
    If I delete the <%= form.text_field :name, :size => 40 %> line from my code, the form gets at least loaded…

    (Dave says: that means your users table doesn’t have a column called name)

    2006-05-28
    150TYPO

    Two lines above the second code inset: s/eihter/either/

    2006-05-28
    82SUGGEST

    If you have added a product that matches the name of one of those in add_test_data, it won’t be updated when rake db:migration is ran. I used the title from the example back on page 70 when I was told to add a product earlier in the book. I think a little more detail on the add_test_data and migration process works would be very helpful here (or at least a reference to where to find detailed info on migration).

    (Dave says: isn’t this covered when we talk about vlidation: the validations we wrote check that you cann’t have duplicate names..)

    2006-05-28
    173TYPO

    has_many :orders, :through => :line_items
    end

    should be:

    has_many :orders, :through => :line_items

    1. ….
    2006-05-28
    89OK

    In index.rhtml:
    <%= product.price %>
    needs a:


    inserted after it to get the same layout as Fig. 7.2

    (Dave says: Not if you use the supplied test data, as it has

    tags around the description)

    2006-05-28
    140TYPO

    2nd paragraph: “Because we added the belongs_to
    declarion to LineItem” should be “Because we added the belongs_to declaration to LineItem”.

    2006-05-28
    192OK

    The two “cart.add_product rails” statements can be DRY’d by a little Ruby magic like “2.times { cart.add_product rails }”

    (Dave says: They could, but I think it’s clearer laying them out in this case)

    2006-05-28
    190SUGGEST

    It could be real useful to provide a listing of Active Record’s built in error message table. I couldn’t find it documented anywhere but by looking at the source code.

    2006-05-28
    190TYPO

    “built in” should read “built-in” (look who’s talking :)

    2006-05-28
    195OK

    “…waiting for us in the test/functional directory.” Readability might be improved by ending the line with a colon instead.

    2006-05-28
    195OK

    About the “setup()” notation: many Rails developers are new to Ruby and might be struck by this notation. After all, where are the parameters in the method definition? Just writing “setup” might be less ambiguous and not necessarily wrong. (I’ve seen you use this on page 189 too.)

    2006-05-28
    84TYPO

    In the sidebar "What

    2006-05-28
    49TYPO

    change “thhow” to “how”.

    2006-05-28
    196TYPO

    “The assert_response() … was successful” misses a closing dot.

    2006-05-28
    197TYPO

    “logged-in” should read “logged in”.

    2006-05-28
    200TYPO

    “The parameters are as follows.” I know it’s a matter of style and I’ve whined about it previously, but it might be more correct to end that line with a colon instead of a dot.

    (Dave says: I tend to leave these to the copy editor, but I’ve changed this (and others))

    2006-05-28
    201TYPO

    “functional-test assertions” should read “functional test assertions”.

    2006-05-28
    205ERROR

    I don’t think there is such a thing as “a browser field”. There’s a though, so perhaps this could be worded better.

    2006-05-28
    205TYPO

    “mime-encoded” should read “MIME-encoded”.

    2006-05-28
    200SUGGEST

    The “dave = users(:dave)” statements can be DRY’d in the setup method.

    (Dave says: they could, but then I’d have to show it… ")

    2006-05-28
    192SUGGEST

    On page 207, you instantiate the products fixtures as ruby_book and rails_book. It would probably be more consistent and less ambiguous if you would here as well.

    2006-05-28
    210TYPO

    “but its still pretty readable”: “its” should read “it’s”

    2006-05-28
    212TYPO

    “integation” should read “integration”

    2006-05-28
    216SUGGEST

    A note on consistency: here you’re referring to the symbol :index whereas all your previous code uses the string ‘index’ for assertions.

    (Dave says: let’s sneak in both uses… :)

    2006-05-28
    175TYPO

    Second line of next-to-last paragraph: “you enter the URL” — only one “the”

    2006-05-28
    210SUGGEST

    Since the source files are named dsl_ as well, it might be nice to note that the “minilanguage” in fact is a domain-specific language. Also, it might be more consistent to write either “minilanguage” or “mini-language” but not both (e.g. page 211).

    2006-05-28
    175TYPO

    Extra space after reference to “Figure 12.2”

    2006-05-29
    224TYPO

    Should “Which we do in the Pragmatic Programmer store” read “Which we have done for the Pragmatic Programmer store”?

    2006-05-29
    226TYPO

    “or WEBrick, We’ve been using this…” should read something along the lines of “or WEBrick, which we’ve been using…”

    2006-05-29
    229TYPO

    “Rail’s” should read “Rails’”

    2006-05-29
    229SUGGEST

    Now that Rails has a stable branch, linking to that one might be another option worth mentioning.

    2006-06-12
    230TYPO

    “Figure 6.1, on page 62 shows…” should probably read either “Figure 6.1 on page 62 shows…” or “Figure 6.1, on page 62, shows…”

    2006-05-29
    231TYPO

    Continuing my nitpicking :) - “dbfile” under “development_sqlite” is aligned with the entry above it, but no such alignment is present at “development_mysql”. Also, it might be more correct to end the line “Environment files typically do three things” with a colon.

    2006-05-29
    233TYPO

    “Then the following happens” should probably end with a colon (and I’ll now quit my enduring whining about colons by noting that lines signaling the start of a bulleted list should generally end with a colon).

    2006-05-29
    102TYPO

    in the last sentence of the paragraph following the graphic, change “tart” to “start.”

    context:

    Let

    2006-05-29
    213SUGGEST

    Page 213, last sentence: If the response is a redirect, follow it and any subsequent redirects, until a response that isn’t a redirect is returned.

    2006-05-29
    217TYPO

    First paragraph of section P&B: Use an em-dash (—-) in the next to last line, please.

    2006-05-29
    228TYPO

    2nd paragraph - “it simply tells your each of your application…” should probably be something like “it simply tells your application…”

    2006-05-29
    130ERROR

    Hiding the cart as directed did not work for me in IE7, while it did in Mozilla. Normally I wouldn’t have such a blind eye, but the problem occurred exactly as described on page 131, which led me to believe I had coded wrong and wasted time debugging: “… we see a flicker in the browser as the cart is first displayed, and then hidden and slowly revealed by the blind_down effect.”

    (Dave says: this is an issue with IE quirks mode, and is fixed by including the correct DOCTYPE in the layout (which I didn’t have)

    2006-09-22
    182TYPO

    user_test.rb is missing from the unit listing and login_controller_test.rb is missing from the functional listing.

    2006-05-29
    63TYPO

    There’s a missing closing parenthesis near the bottom of the page: change
    “(saying something like (in /Users/dave/work/depot), or”
    to
    “(saying something like (in /Users/dave/work/depot)), or”

    2006-06-12
    74TYPO

    The sentence starting with “How often have you implemented…” should probably end with a question mark.

    2006-06-12
    253TYPO

    “Figure 16.1 , shows”: there’s a space leading the comma, but I believe the comma can be omitted.

    2006-07-14
    141TYPO

    “Or maybe the user has tried to enter an order, but their data hase failed validation.”
    => ‘hase’ to ‘has’

    2006-06-12
    141TYPO

    End of page…

    "Before we start on our final form, let

    2006-06-12
    144TYPO

    End of page…

    "you

    2006-06-12
    145TYPO

    For consistency throughout text…

    “…dropdown…”
    => “…drop-down…”
    (Also in the footnote)

    2006-06-12
    viiSUGGEST

    “So Where’s Rails?”
    => “So, Where’s Rails?”

    (Also change linked-to section header).

    2006-06-12
    157SUGGEST

    Perhaps a footnote that the \\ character in the generator statement is a shell command. Thought it might be part of the statement at first, which happily created a “\\.rhtml” file and a “\\” method in the login controller to no ill effect until several pages later.

    2006-06-12
    154SUGGEST

    Perhaps explain the presence of “wibble” in

    string_to_hash = password + “wibble” + salt

    which seems obscure.

    2006-06-12
    72SUGGEST

    You suggest the convention for migration names as follows:
    depot> ruby script/generate migration add_price

    But that doesn’t indicate which table we are adding the price column too.

    Wouldn’t it be better to use:
    depot> ruby script/generate migration products_add_price

    so that the name is more descriptive of what is actually happening?

    (Dave says: yes, that’s a good convention)

    2006-06-12
    75OK

    In IE6, the default display of the red borders around non-validated controls does not display correctly… the right hand red border is spread right across the page showing up as a big fat red block, instead of just a simple border. The stylesheet shows:

    .fieldWithErrors {
    padding: 2px;
    background-color: red;
    display: table;

    Which isn’t interpreted by IE6 very well.

    It may be beneficial to show a work around / fix for this, or at least make a comment about it so we don’t feel like we are heading down the line of a non-IE friendly web development platform.

    (Dave says: this sounds like a bug in Rails: perhaps it should be reported to the core team)

    2006-06-12
    81OK

    Downloading depot.css is suggested, but I think it should mention changing the layout to use this new stylesheet rather than the scaffold stylesheet.

    (Dave says: that’s on page 84)

    2006-06-12
    225TYPO

    Section “lib/”: s/fit fit/fit/

    2006-06-12
    229TYPO

    Second text paragraph: Replace the en-dash (—) with an em-dash (—-) in the fourth line: Gems—-it

    (Dave says: good eye!)

    2006-06-12
    242TYPO

    First paragraph: “… for Rails’ internal use.”

    2006-06-12
    104ERROR

    Instead of

    2006-07-13
    0TYPO

    On the ‘Beta Book’ information at the very start of the book, paragraph 4:

    In the meantime, we

    2006-06-12
    226TYPO

    Near bottom of page: "using LighTTP (if it

    2006-06-12
    81ERROR

    The logo.png image is not on your server to download.

    2006-06-12
    123OK

    redirect_to_index() in store_controller.rb doesn’t seem to work after each “Add to Cart”. “Add to Cart” does not update the page automatically. However, “Empty Cart” seems to work fine.

    (Dave says: it seems to work here. Could you try it with the downloadble code and see what happens?)

    2006-07-13
    96OK

    The image of the web page with the “Add to Cart” button shows the button adjacent to the item price. However, Rails renders the button with a

    around it, so it’s going to appear below the item price (which is how it looks in FireFox 1.5.0.3 on OS X 10.4.6).

    (Dave says: this is how it looks in Safari. It may look different in your browser. Got to love standards…)

    2006-06-12
    126OK

    This bit of code line doesnt work..

    page[:cart].replace_html :partial => ‘cart’, :object => @cart

    It works only if this format is used.

    page.replace_html ‘cart’, :partial => ‘cart’, :object => @cart

    (Dave says: could you update to the latest Rails and let me know if it is still not working?)

    2006-06-13
    140TYPO

    Middle of page sentence is missing ‘that’: “Now we have our tables and our models,” should be “Now that we have our tables and our models,”

    (Dave says: I leave this kind of thing to Kim, our copy editor..)

    2006-06-12
    35OK

    Re “Making Development Easier” (auto-reload in development mode):
    It doesn’t always work! In particular, it appears that it you have a session open and modify the Cart class code, the edits don’t take effect. This is probably obvious to the experienced, but the tutorial in the book runs straight into this problem.

    (Dave says: but, it then shows you how to fix it… :)

    2006-06-12
    190TYPO

    “it’s built in” should be “its built-in”

    2006-06-12
    191TYPO

    “if not it adds” should be “if not, it adds” to keep parallel structure with the beginning of the sentence (“If so, …”)

    2006-06-12
    192TYPO

    “Ruby book’s price” should be “the Ruby book’s price”

    2006-06-12
    129OK

    When I got to page 141, my code (see p.104) had the “current_item” object called “existing_product”. So it appears you have changed from calling it existing_product to current_item.

    (Dave says: that’s right—it changed name because it serves a different purpose now)

    2006-06-13
    84TYPO

    Near the end of the 2nd paragraph of the sidebar, “They technical term is idempotent…” should be “The technical term is idempotent….”

    2006-06-12
    49TYPO

    foot-note “We’re tried” -> “We’ve tried”

    2006-06-12
    169OK

    The delete_user method as-is results in an error:
    “undefined local variable or method `user’”

    I found that adding a line:
    user = User.find(id)
    before the “if id && user…” line solved the situaton for me, but I’m uncertain if this is the correct fix for this problem.

    (Dave says: my guess is you mistypes the if statment to be "if id && user == User.find)

    2006-06-12
    103SUGGEST

    Section 8.3 jumps into creating the CartItem class without describing where the class file belongs. (Though its location can be inferred from the link to the download of the file.)

    2006-06-12
    192OK

    The assertion “test_add_duplicate_product” fails for the price.

    the code:
    assert_equal 2*rails.price, cart.total_price #failure?
    error message:
    <20> expected but was <10>

    I thought this is may be because the inject method is not invoked properly and changed the assert to verify total items, but this passes the test.
    “assert_equal 2, cart.total_items #cart.items[0].quantity”

    Any idea what could be the error?

    (Dave says: It’m afraid it works fine here. Bring it up under script/console and check cart.total_price. Also, make cure that cart_items.price is correctly defined)

    2006-06-12
    n/aSUGGEST

    WHY are you using SQL in your migrations for foreign keys? This seems like a very non-RoR thing to do! ;o) How about this instead:

    http://www.redhillconsulting.com.au/rails_plugins.html

    (Dave says: I don’t like the defaults of this plugin, but I do plan to plug it in the new Migrations chapter).

    2006-06-12
    209OK

    The integration test runs fine, but I couldn’t find the (new) order in the database? Does the test deletes the entries after running them?

    (Dave says: all tests do a rollback at the end)

    2006-06-12
    216OK

    When I run the performance test I get the following error:

    NoMethodError: undefined method `stringify_keys!’ for #

    Think this is something to do with MySQL, any suggestions?

    (Dave says: hmm.. seems to work here. Perhaps try copying the source down from the web site and see if that runs for you)

    2006-06-12
    92ERROR

    Formatting of the store/index page is incorrect. The dotted bottom border of the

    is placed above the price of the item.
    Looks like in the depot.css the property float:left is not needed in:
    #store .entry .price {
    color: #44a;
    font-weight: bold;
    margin-right: 2em;
    /* float: left; */
    }

    2006-07-13
    80OK

    "If you refresh your browser, you should see no dif ference in the page that

    2006-06-12
    156TYPO

    Is the comment line “# …” in the listing for any particular reason?

    2006-06-12
    165TYPO

    In the sidebar “A Friendlier Login System”, the change you make using session[:original_url] does not match the above session[:original_uri]

    (Dave says: I believe they both say _uri)

    2006-06-12
    67SUGGEST

    I made the mistake of adding the columns to the 001_create_products.rb file but not saving the file before running “rake db:migrate”. The result was the products table only had an “id” column. Saving the file and re-running “rake db:migrate” didn’t add the columns. I fixed things by running “rake db:migrate VERSION=0”, followed by “rake db:migrate”. Seems like a common enough error that you might want to mention it.

    2006-06-12
    0TYPO

    Oops just read the page numbering note.

    ignore #3813:

    1st paragraph, 3rd line
    currently -> this content a many
    change to -> at this content many

    2006-06-12
    118OK

    I get a different error from the 2 solved around page 118:
    NameError in Store#add_to_cart
    uninitialized constant Reloadable
    /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:200:in `const_missing’
    #{RAILS_ROOT}/app/models/cart.rb:11

    where do i go to fix these problems?

    (Dave says: update your version of Rails)

    2006-06-12
    148ERROR

    for windows environment, need to specify -u option as follows:
    depot>mysql -u root depot_development

    Otherwise, the following error will result:
    … Access denied for user ‘ODBC’@localhost’ (using password: NO)

    2006-06-12
    113SUGGEST

    Ph 106 says, "[The client] points out that we

    2006-06-12
    147TYPO

    In the last paragraph you tell us to clik “Checkout” button, but that should be “Place Order” button right?

    2006-06-12
    163OK

    On my system, the flash message “User dave created” still hangs around above the Welcome message when I point at http://localhost:3000/login. How can this be removed?

    (Dave says: I don’t see that problem)

    2006-06-12
    116OK

    I think you wanted a space before the “×” in the line in add_to_cart.rhtml: "

    <%= cart_item.quantity %>×

    2006-06-12
    133TYPO

    At the top of the page:

    "the main page doesn

    2006-06-12
    24TYPO

    In the section “Locomotive Mac Installation” the last line of the third paragraph states:

    Access it from the Rails > Open Terminal menu option.

    it should read:

    Access it from the Applications > Open Terminal menu option.

    2006-06-12
    116OK

    The definition of total price invokes a method on CartItem that does not take into account the quantity, it should be changed to:

    def total_price
    @items.inject(0) { |sum, item| sum += item.total_price }
    end

    and a total_price method should be added to CartItem:

    def total_price
    price * quantity
    end

    (Dave says: have a look at the existing CartItem model…)

    2006-06-12
    168TYPO

    in the first listing you have
    dave[code/depot_q 19:20:09] script/console

    which should include the ruby command and for consisency with previous command line examples should read

    depot> ruby script/console

    2006-06-12
    168TYPO

    Since we have already written the delete_user action suggest:

    And then write a delete_user action in the login controller.

    should be

    And then modify/re-write the delete_user action in the login controller.

    2006-06-12
    169SUGGEST

    Add after the line

    session[:user_id] = nil

    a line to remove the original_uri in session also, otherwise they don’t always get redirected to login/index to see the orders.

    session[:user_id] = nil
    session[:original_uri] = nil

    2006-06-12
    145ERROR

    In the models/order.rb code snippet, I had to put the “validates_inclusion_of” line after the definition of the “PAYMENT_TYPES” array, to avoid a run-time error. If that is indeed necessary, there should be a mention in this area.

    2006-06-12
    127SUGGEST

    Another hint if the Ajax magic doesn’t happen: - Did you remember to delete the add_to_cart.rhtml file?

    2006-06-13
    26OK

    It is probably a formatting error. Footnote 6 is truncated.

    6A newly created Rails application enters the world containing 44 files spread across 36

    (Dave says: (it continues on the next page, but we’ll fix that during layout)

    2006-06-12
    168SUGGEST

    Suggest then that the 006_create_line_items.rb migration be ammended to cater for this situation during forward and backward migrations.

    The following will ensure an “admin” user is inserted with a password of “password”

    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

    execute “INSERT INTO users (`name`, `salt`, `hashed_password`) VALUES ('admin', '982014440.257920467993245', 'c0d230ce90af6ed0e00b38961d5b76a39bbbe156')”

    end

    def self.down
    drop_table :users
    end
    end

    (PS: This may be deemed a security issue, so a better solution may be possible, such as allowing navigation to add_user if there are 0 users in the database).

    (Dave says: added as an exercise)

    2006-07-16
    164OK

    After deleting my session information, the first time I navigated to http://localhost:3000/admin/list, I got to the list successfully. After forcing a refresh in my browser (FireFox 1.5.0.4, OS X 10.4.6), I did get to the login page—I think the first time, I got a cached page.

    (Dave says: strange—I don;’t see that)

    2006-06-12
    95TYPO

    In the footnote, ‘layout’ is used as a verb (it’s a noun). Change to ‘lay out’ as in:

    …to make them lay out properly.

    2006-06-12
    74SUGGEST

    Prices are stored as integers, right? So, if a product has a price of $56.43, the admin user would need to type in “5643”, right? Wouldn’t it be easier for the admin to type in “56.43” and have the model convert that into an integer?

    (Dave says: yes, but that would muddy the explanation at this point. We’ll cover that in the second part of the book)

    2006-06-12
    212TYPO

    In the description of the cookies attribute:

    “read values form the hash”

    should be:

    “read values from the hash”

    2006-06-12
    62TYPO

    “caLlout id” should be “callout id”

    2006-06-12
    216TYPO

    I’m just learning rails and ruby. Read book one or twice thru. I give it an A-.

    Most of my problems when working on my first application involve understanding what gets passed into what automatically. And what I have to send in. In Java, this would be a pure scope issue. But with Rails doing a lot behind the scenes. It would be nice to understand just what information is available say from the controller to the template and from the template to the partial. How things get passed from a template into a partial. Granted I’m new to ruby as well. Some of my challenges have been when to use the @ sign or not. ;-). But the ruby scope is defined fairly clearly in the Pickaxe.

    In summary, perhaps a scoping summary table of what’s exposed to what in the framework. And another table of how things get passed into helpers, templates and partials.

    Most of the information is spread throughout the book. But not all of it in one easy place. Sometimes in the APIs, but not always consistently (for example, there is no mention of :object hash in the API for partials). If you know of one, let me know.

    This knowledge has just about clicked for me (but only with some pain).

    (Dave says: Rails has a lot more magic than Ruby, and it doesn’t really have tidy scoping the way RUby does)

    2006-07-13
    187TYPO

    Third-to-last paragraph: “All of the
    testig assertions accept an optional trailing parameter…” (Notice “testig” != “testing”)

    2006-06-12
    187TYPO

    Once again, third-to-last paragraph: “All of the
    testig assertions accept an optional trailing parameter containing a string.
    This will we written out along with the error message if the…”

    This should be: “…This will [[be]] written out along with the error message if the…”

    2006-06-12
    1OK

    Second paragraph first sentence. “seem” should be “seemed” because it is past tense.

    (Dave says: hmm.. I meant it to be present tense. Let’s see what the copy editor says…)

    2006-06-12
    173OK

    It will be great to have an example on how to link two different tables associated using a lookup table. e.g. in the diagram 12.1, the arrows point outside.

    (Dave says: there is a lot of data modeling stuff that I don’t really have space to document here)

    2006-07-25
    115OK

    Dont know if this might be intended, but in the source below “private” the find_cart function isn’t visible, mabe add it, or a comment eg. #rest of controller

    2006-06-12
    31OK

    "We

    2006-06-12
    18SUGGEST

    Line 3: “… We discuss builder templates starting on page 403.”

    This seems disconnected to the rest of the paragraph: ‘Templates’ have been discussed so far, not ‘builder templates’. Either remove the word ‘builder’, explain the difference between ‘templates’ and ‘builder templates’, or explain why the name has changed.

    2006-06-12
    168OK

    A question I also asked on the forum: why implement things like safe_delete() and delete_user() when there are callbacks like before_destroy() available? The latter could potentially prevent a lot of footshooting in case one forgets to actually use our custom delete_user(). Are there any disadvantages here that I’m missing? I’d like to suggest a throwback to the first edition, where you indeed used before_destroy().

    (Dave says: you can’t use before_destroy, because it isn’t transactional. You can do the test in the filter, and then someone else could delete another user, and then your own delete takes place)

    2006-10-18
    139SUGGEST

    There are code chunks showing how files should look in numerous places, I find it fairly irregular. Sometimes only the new change is listed, sometimes its the change and #rest of model and sometimes its the entire model. I think you should stick to one of these three (preferable “new code” + #rest of model/controller/view).

    2006-06-12
    84TYPO

    In the sidebar, 2nd paragraph, 4th sentence “…A GET request is defined by HTTP to be used to retrieving data:…”, ‘retrieving’ should be ‘retrieve’.

    2006-06-12
    81SUGGEST

    says: “…code base would have to do the same. And, if we were working on a team on this project…” which seems just a tad unnatural. I’d suggest “with a team on this project”.

    2006-06-12
    68SUGGEST

    Modification needed for MySQL4.0.13 for rake db:migrate

    I received a rake abort, MySQL error when I tried rake db:migrate. Apparently the Create table statement in MySQL 4 is slightly different than MySQL 5 in that MySQL 5 has ‘ENGINE=InnoDB’ while MySQL4 has ‘type=InnoDB’. Next I tried:
    rake db:migrate —trace
    And identified the file in activerecord mysql_adapter.rb where I changed from ‘ENGINE=InnoDB’ to ‘TYPE=InnoDB’.

    Now the products table is created successfully.

    (Dave says: this sounds like a bug in Rails…)

    2006-06-12
    152SUGGEST

    About the footnote: it might be useful to elaborate why a reader should also take a look at Rails Recipes. Other than a shameless plug, what is the advantage on a technical level?

    Dave says: because it shows role-based authentication, too

    Roderick says: then that may be worth mentioning, because it now seems to come from nowhere

    2006-06-12
    130OK

    with add_to_cart.js visual effect only works when the item has already been added to the cart. If being added for the first time I get $(“current_item”) has no properties. I fixed it by surrounding the visual effect expression with an if statement. There is probably a better way to do this I imagine.

    (Dave says: I’ve tried it here with both Safari and Firefox, and it seems to work OK. Have you tried using the downloaded code?)

    2006-07-13
    145SUGGEST

    Sometimes you use line-numbers in the code examples, making it hard to just copy-paste.
    EG;
    Line 1 def save_order

    - cart = find_cart - order = Order.new(params[:order])

    - order.add_line_items_from_cart(cart)
    5 if @order.save

    - session[:cart] = nil
    - redirect_to_index(“Thank you for your order”)

    (Dave says: that’s why we have a download link, and why you can download the whole chunk of code from the site. I add line numbers to help folks cross reference)

    2006-06-12
    133TYPO

    I believe this sentence, "Bruce doesn

    2006-06-12
    111SUGGEST

    The UnixUtils package referred to in the footer is old and unmaintained. I’d recommend pointing to the GnuWin32 project at: <http://gnuwin32.sourceforge.net/>

    Specifically, the CoreUtils package contains the ‘tail’ program: <http://gnuwin32.sourceforge.net/packages/coreutils.htm>

    2006-06-12
    99SUGGEST

    I’m not sure if this is an error in my understanding. Near the bottom of page 99 when discussing find_cart you say:

    “We can achieve that by creating a helper method,”

    However, this method then goes on to be put in the store controller.

    When i read the line and it said create a helper method, my mind immediately thought back to the previously discussed helper files - so if it is indeed a helper method i was expecting to go and edit a helper file for store. Instead, the method is put in the store controller?!

    2006-06-12
    89OK

    Is there any reason why you’re using the ERB <% -%> form on this page, when there doesn’t seem to be any potential problem with end of lines? You don’t use this form on page 80 for a similar example…

    (Dave says: I didn’t write the code on page 80—the scaffold generator did)

    2006-06-12
    34TYPO

    Middle of page:
    “OK. You Windows users are done: you can skip forward to on page 24. ”

    Specify “forward to” what or omit “on”.

    2006-06-12
    n/aSUGGEST

    The yellow triangle indicators that show changed/added lines in the examples are hard to see in the pdf. Could they be made to stand out a bit more?

    2006-06-13
    119SUGGEST

    “You can render a partial from another template or from a controller
    and the partial will return the results of rendering itself.”

    You introduced partials as ‘a kind of method for views’. I really like this analogy, but I think you could perhaps detail the mapping between the two a little more explicitly. For example, you use the verb render, when perhaps it would make sense to initially use the word invoke, and then explain that invoking a partial is the same as rendering it. i.e. you invoke a method, but you render a partial.

    Also, a very mild point. The phrase “..and the partial will return the results of rendering itself” is slightly ambiguous. It could mean that the partial itself will return the results of rendering, or that when invoked, a partial will render itself and return the results of that rendering.

    2006-06-12
    246SUGGEST

    The examples use .at_beginning_of_xxx except for one .beginning_of_quarter and there is no mention of the aliasing (i.e. all the methods are available with and without leading "at". Either mention the aliasing in the text or don’t confuse the reader by using a single method without the leading at.

    2006-06-12
    142SUGGEST

    “Within this block, you can put normal template stuf f (such as
    the

    I’m sure that most people will know why the

    (Dave says: I changed the text to talk about

    insted. I don’t want to divert into an HTML markup discussion here)

    2006-06-12
    191SUGGEST

    “We’ll simply copy the boilerplate from the product_test.rb file…”. Since product_test.rb has already been significantly modified at this point, wouldn’t it make sense to suggest copying the boilerplate from any of the other unit test files?

    2006-06-12
    192TYPO

    “…between multiple test cases…” -> “…among multiple test cases…”

    2006-06-12
    195SUGGEST

    Suggest changing “…these tend be be used infrequently when testing Rails applications, we won’t discuss them here…” to “…these tend be be used infrequently when testing Rails applications—we won’t discuss them here…”

    2006-06-12
    158OK

    should probably be “user-form” ?

    2006-06-12
    160OK

    should probably use a different class

    (Dave asks: is it not OK as it is?)

    2006-06-12
    335SUGGEST

    The text on ‘created_at’ doesn’t tell me whether I should define it as a datetime or a timestamp. The docs for ConnectionAdapters::TableDefinition likewise don’t distinguish between these types, except that they both have names.

    MySql has both types but Postgresql has only a few varieties of ‘timestamp’ (with and without timezone).

    (Dave says: thanks for nudging me—it looks like you can store the timestamo into a date, datetime, or string)

    2006-07-25
    413TYPO

    "If the image path doesn

    2006-10-04
    168-169OK

    user.rb :

    Which is the difference between “password" (instance variable) and "self.salt", "self.hashed_password"? Why not to use "self.password" or "salt”?

    I think it is not clear enough.

    (Dave says: @passwrod is an instance variable. self.password is a call to a method)

    2006-06-13
    65SUGGEST

    “DDL” is mentioned in the second to last paragraph, but no where in the pdf is this acronym defined.

    2006-06-12
    79SUGGEST

    Why is the model name “product” in lower case on the command line here, but uppercase on page 66?

    Would prefer both to be lower case for uniformity, so the reader does not spend time doing research to find that it doesn’t matter.

    2006-06-12
    157SUGGEST

    This isn’t exactly an error, but on page 15, you generate the Login with several methods. You do not include the method index() among those, yet it is created in the pages that follow, even before delete-users, list_users, or logout are implemented, so it might cause a little less confusion if you included it on the command line.

    2006-06-13
    81ERROR

    The images repository linked from this page (URL below) doesn’t contain “logo.png” which is needed for the layout introduced on page 91 of the PDF.

    http://media.pragprog.com/titles/rails2/code/depot_c/public/images

    2006-06-16
    255ERROR

    Re :null — “If true, the underlying column has a not null constraint added” — s/true/false/.

    2006-07-14
    261TYPO

    “For example, you might notice that once you application has a large number of
    orders in the database…” s/once you/once your/.

    2006-07-14
    261TYPO

    “Rails takes responsibility for incrementing the value of this column for each new row added toa table.” s/toa/to a/.

    2006-07-14
    263ERROR

    The example migration to create the books_authors join table contains two errors: create_table :books_authors(:id => false) should not use parenthesis; it should read instead: create_table :books_authors, :id => false. Also, the column definitions are missing a data type (:integer?) before :null => false.

    2006-07-14
    265ERROR

    AddUsers.down reads “drop_table = :users” but I think should be “drop_table :users”.

    2006-07-14
    418OK

    It might not be obvious from the Forms Containing Collections side bar
    that the select form helper in the following sections can be used in a
    similar manner:

    assuming that products has a product_type_id and that product_types has
    a name column:

    controller:
    product_types = ProductType.find_all product_type_select = @product_types.collect { |type| [type.name, type.id] }

    view:
    <%= select (‘product[]’, ‘product_type_id’, product_type_select, :selected => product.product_type_id) %>

    Product.update(params[:product].keys, params[:product].values)

    would then work as with the text_field shown in the side bar.

    2006-10-04
    271TYPO

    “Install the annotate_models plugin using the following command (which has been spolit onto two lines…” s/spolit/split/.

    2006-07-14
    260TYPO

    OrderHistory.create(:order = order, :notes => “test”)
    should be OrderHistory.create(:order => order, :notes => “test”)
    note the hash after :order

    2006-07-14
    251TYPO

    Second paragraph, first sentence: “Let’s start by look at migrations at an abstract” should be ‘looking at’ or ‘examining’.

    2006-07-14
    264OK

    populate a table seem to not run under postgresql

    code
    User.create(:name => “yo”, :password => “#{Digest::SHA1.hexdigest(‘yo’)}”).save!

    stacktrace
    yo:$ rake migrate
    (in /Volumes/Data/Repository/rst)
    Admin: migrating =
    — create({:name=>“yo”, :password=>“c41975d1dae1cc69b16ad8892b8c77164e84ca39”})
    rake aborted!
    undefined method `create’ for #

    (See full trace by running task with —trace)

    (Dave says: I don’t see this code in the book. However, create automnatically saves the record)

    2006-07-14
    259TYPO

    In the first sentence under the “Renaming Tables” heading, change “we sometimes fine ourselves” to “we sometimes find ourselves”

    2006-07-14
    269TYPO

    In the sentence just before the “16.6 When Migra…” heading, change “that authomatically handles” to “that automatically handles”

    2006-07-14
    251TYPO

    First para second line. Says: “Wouldn’t it me more convenient …”. Should be “Wouldn’t it be more convenient …”. Change me to be.

    2006-07-14
    258TYPO

    The second last para begins with “If you specify force => true, the migration will …”. I think it should use the symbol :force and not just force. So the correct line should be: “If you specify :force => true, the migration will …”.

    2006-07-14
    261TYPO

    The para just above the section “Primary Keys” towards the end mentions about “passing an array of colum names to create_index”. There is no other mention of create_index in the book. I think it should be add_index.

    2006-07-14
    270TYPO

    Last para just before the code which defines run_with_index. The last line begins as “This could be a private method in the model, or or could…”, has the word “or” twice.

    2006-07-14
    271TYPO

    Third last para, second statement: “To keep track of the schema as it evolves, you can uuse the..”. The word use is miss-spelt as “uuse”.

    2006-07-14
    439SUGGEST

    I realize the 2nd edition of the Form Helpers section hasn’t been released yet. Having read the 1st edition text, this seems to be a part of the text that I found a good deal less clear than the rest of the book. I would especially like to see addressed editing a many to many relationship with checkboxes, or the case where the join table is actually a model itself. Thanks.

    (Dave says: I believe the Recipes book covers this)

    2006-10-04
    134SUGGEST

    After Ch 9, there is a minor issue with the flash[:notice]. After you enter an invalid item via an explicit url, the flashed message is never removed after new valid items are selected. It continually displays “Invalid product”.

    (Dave says: great idea for an exercise)

    2006-07-15
    n/aSUGGEST

    I don’t recall if it has been suggested before, but I would love if the “Building an Application” section contained, at the end of each task or sub-task, a series of suggested exercises to extend the sample application in small ways to help reinforce the learning process. It’s not always easy when your learning a framework to think of ways to extend examples that fall within the limits of what you have learned.

    2006-07-25
    218SUGGEST

    Since there are 1000, not 100, products in the performance products fixture, should “…the block creates 100
    orders using each of our 100 products…” be changed to something like “…the block creates 100 orders using the first 100 of our 1000 products…”?

    2006-07-13
    226OK

    “…customs documentation for shipping…” s.b. “…customizes documentation for shipping…”

    D (Dave says: customs doc. is required for international shipping)

    2006-07-14
    226TYPO

    “…to include of PDF receipt writer…” s.b. “…to include the PDF receipt writer…”

    2006-07-14
    250TYPO

    Last paragraph: One scheme is to keep …

    2006-07-14
    271TYPO

    Second paragraph: they edit the existing migration

    2006-07-14
    269ERROR

    "databases just don

    2006-07-14
    68OK

    You created footnote 3 based on the erratum suggestion #3810, but I hope you might take another look at improving it.
    You mention that runing migrate VERSION=0 is only for those feeling “frisky”, but I find that “rake migrate VERSION=0; rake migrate” Is much more convenient than dropping and recreating the database in another tool then rerunning the migration. I usually have a migration along the lines of 001_initial_setup.rb and as I’m specing out the app, I will add columns to it then run migrate VERSION=0 to drop all the existing tables then migrate to get my fresh schema.

    (Dave says: I’m glad you experience is good, but othher find VERSION=0 very frustrating, particularly if they have had an error in a migration which leaves the database in an inconsistent state. My experience from teaching Rails is that it’s easier to drop and recreate the database)

    2006-06-16
    268TYPO

    About halfway down it says ‘foreigh_key()’ instead of ‘foreign_key()’

    2006-07-14
    138TYPO

    In the last sentence of the footnote “aplugin” should be “a plugin”

    2006-07-13
    92ERROR

    last paragraph before section 7.3, you mention the depot.css file, but the link is broken.

    2006-07-13
    159TYPO

    The closing > on all the labels are blue instead of red.

    (Dave says: we must get cleverer code formatters… :)

    2006-07-13
    173TYPO

    The arrow to the line_items table does not have an arrow, but the arrow from it does.

    2006-07-13
    248TYPO

    “specific” is spelled wrong in “You may have
    noticed that the Time class has a similar extension for formatting datetime
    fields in a database-sepcific format.”

    2006-07-14
    243OK

    Where is says “(For strings, it first strips leading and
    trailing whitespace before testing.)” many programmers will be left wondering why it strips both leading and trailing whitespace instead of just leading (or trailing) whitespace prior to testing for a string being empty? If there exist non-whitespace characters which can compose a string that is considered “empty”, what are these characters?

    (Dave sys: because that’s what the code does… It calls str.strip.empty?, and strip removes leading and trailing whitespace. Agreed, it could be optimized…)

    2006-07-14
    230TYPO

    Bottom line: “This is less risky that having your project…” should read “less risky than” (p230 on page, p242 in PDF)

    2006-07-14
    81TYPO

    depot> ruby script/generate migration add_test_data
    Create db/migrate
    create db/migrate/003_add_test_data.rb

    I think “Create db/migrate” should be “exists db/migrate”

    2006-07-13
    100112OK

    > Should be:
    > @cart = (session[:cart] ||= Cart.new)
    >
    > - —
    > Peter Harkins - http://push.cx

    Otherwise, page 115 won’t display, instead displaying an error that item is nil

    (Dave says: it seems to work fine here. The code on 115 seems to set @cart when needed)

    2006-07-13
    248TYPO

    ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
    :Ordinal => “%Y-%j”
    :Ordinal —> should be :ordinal (lowercase)

    2006-07-14
    79OK

    for the validate method, change it to “if !price.nil? && price <= 0”

    There is already a check for nill with validate_presense_of, and you’ll get the ‘must be positive’ message when it’s not needed.

    (Dave says: try it without and see :)

    2006-06-25
    550SUGGEST

    "If it

    2006-09-26
    271TYPO

    third line of first paragraph in section 16.8 - Managing Migrations (page 271) - potentially misspelt as potenially

    2006-07-14
    99TYPO

    Just below the heading “Putting Sessions in the Database”, you have the following paragraph:

    “”Rails makes it easy to store session data in the database. First, we need to create a database table with the correct layout. We

    2006-07-13
    82OK

    When I use the h function in list.rhtml as included in your file to download, it simply shows the

    inside the page. When I take the h() out, then it shows the actual html?

    http://dusty.name/rails/with_h.tiff
    http://dusty.name/rails/without_h.tiff

    Thought it would be easier to show you.

    Perhaps I have something wrong elsewhere? Right now I’m following along and downloading the pages I haven’t purposely changed anything.

    You can email me at pragmatic@dusty.name if you want more info on it.

    (Dave says: that’s correct—in the product listing, HTML is escaped)

    2006-06-25
    AllOK

    I find the book’s typeface difficult to read, and suggest you consider changing it to something that appears less “heavy.”

    In particular, the letter heights are too similar, so a word like “edit” has the dot of the ‘i’ at the same height as the crossbar on the ‘t’. Even worse is the contraction “it’s” where the dotted ‘i’, crossed ‘t’, and apostrophe are all at the same height.

    Also, the letter spacing is too close, so one letter’s serifs might be nearly touching adjacent letters.

    Maybe the printed book will be easier to read. But I’m reading it with Adobe Acrobat 6 Reader at 110% magnification on a 17" monitor, and it’s very difficult. Even at 125%, it’s still hard.

    Please choose a better typeface. Thanks for listening.

    Mike

    (Dave says: I’m afraid Bookman is a house style. We actually receive quite a few complements on it…)

    2006-06-25
    550SUGGEST

    Hi Dave, Can you provide a sample deployment scenario with lighthttpd as well as with Apache? There is lots of discussion on running RoR apps in Apache 1.3 and not in Apache 2.0…so some pointers will be great.

    (Dave says: lighttpd deployments seem to be falling out of favor, so the book concentrates on apache/mongrel)

    2006-09-26
    1SUGGEST

    Having links to the full code is fantastic, except that I’m finding that the code displays VERY poorly. Something that would be very nice is if the code was highlighted, and formatted on a webpage with the ability to comment it. The commenting alone would be near priceless.

    (Dave says: the problem is that this code gets refreshed every time the book gets built, and so comments on it might become out of date. I understand what you’re saying, and I’m thinking about how we could work it. In the meantime, I fixed that annoying content-type bug on the site…)

    2006-07-28
    60ERROR

    The text talks about creating the depot_development database, but does not say to create depot_test and depot_production (even though those entries are present in database.yml). Then the final paragraph says, “…and if you’ve created databases with the suggested names, you can now skip forward….”

    There should be instructions to create the test and production databases.

    Mike

    2006-07-15
    184TYPO

    Missing the space after depot> in the second command prompt example.

    2006-07-13
    93TYPO

    Follow-up to float: left on price — the formatting error is fixed when the “Add to Cart” button is added. The screenshot on this page (figure 7.2) cannot be accurate.

    (Dave says: indeed—the stylesheet is the one file shared between all versions of the application, and the float: left was needed when the button is added).

    2006-07-13
    215TYPO

    “Constructs a url given a set up options.” -> “Constructs a url given a set of options.”

    2006-07-13
    226SUGGEST

    First full paragraph, "…code that

    2006-07-14
    83SUGGEST

    Aargh! It took me 10 minutes to discover why the refreshed browser page didn’t have alternating background colors, as stated in the first bullet. It’s not until page 85 do we learn how to use the depot.css file.

    It would be helpful to note that the CODE in list.rhtml implements these features, but is incomplete now, and refreshing the browser won’t display everything mentioned.

    2006-07-13
    999DEFER

    I’ve been using the code found here: http://media.pragprog.com/titles/rails2/code/rails-code.tgz and I don’t see any documentation comments in the code…

    For example, in depot_q/app/controllers/login_controller.rb I would expect to see some comments above the class and all def lines. I don’t see any. This would be helpful as it would be a good guide for proper formatting of comments to allow rDoc to work.

    (Dave says: This code is included directly into the book, and having a lot of comments would make the text a lot longer. I should, though, produce a fully commented final version at some point)

    165SUGGEST

    The sidebar for adding a redirect to the original uri after
    login is a welcome addition, but I note that it has one
    remaining nit: the login action doesn’t clear session[:original_uri]. I suggest the following modest change to LoginController#login which cleans up the session before the redirect:

    # Clear the original_uri before redirect
    original_uri = session[:original_uri]
    session.delete(:original_uri)
    redirect_to(original_uri || { :action => “index” })

    2006-07-13
    167SUGGEST

    The delete_user action will perform the delete via a GET. It would be to encourage good HTTP method practices and wrap the body of delete_user in a request.post? guard:

    def delete_user
    if request.post?
    user = User.find(params[:id])
    user.destroy
    end
    redirect_to :action => :list_users
    end

    Of course, this means that users without Javascript enabled
    can no longer delete users. On the other hand, if the page
    gets scraped for any reason we won’t delete all of the users.

    2006-07-13
    92OK

    From what I understand, @content_for_layout is deprecated in favor of just plain yield()?

    (Dave says: no—Marcel was somewhat overly enthusiastic in that blog post)

    2006-06-25
    129OK

    DRY.
    When adding the id=“current_item” I’d suggest
    <tr <%= cart_item == @current_item ? “id=\\”current_item\\“” : “” %>>
    in case we later want to add any more attributes to the tr tag.

    (Dave says: true—if we ended up doing that, we’d probably want to make the change you suggest. But as we don’t need it now, I prefer the clearer code)

    2006-07-13
    229TYPO

    “Building Your Application to a Gem Version” callout, second paragraph “When you application starts” s/b “When your application starts”

    2006-07-14
    261TYPO

    In the first paragraph: “This works as long as your model classes do not contain any addition functionality” s/addition /additional /

    2006-07-14
    253TYPO

    In paragraph 8: “It then decrements the version, looks for the matching files, undoes it…” The case of “files” and “it” disagree.

    2006-07-14
    281SUGGEST

    The 17.3 section: “Primary Keys and IDs” section seems redundant with the side-bar on page 262: “Why Use These Artificial Primary Keys?”

    2006-08-23
    300OK

    Deleting Rows.First Paragraph… "An exception is not thrown if the row doesn

    2006-07-14
    62TYPO

    Bullet #2 is pointed to twice in the body (by the paragraphs discussing the database and username/password fields). The second instance (discussing the username/password field) should point to bullet #3.

    2006-07-15
    69TYPO

    The color of the server output is highlighted in Ruby style - the text following a ‘#’ is green.

    (Dave says: yeah—that’s hard to fix…)

    2006-07-13
    38OK

    missing closing tag:

    (Dave says: it split onto the next page. That kind of thing gets fixed just before we go to press)

    2006-07-25
    25TYPO

    In the footnote: “(the standard warnings APLY)”

    2006-07-25
    272SUGGEST

    You mention that using migrations causes the problem of potentially having your database definition for any table spread over multiple files. One thing to note is that the schema.rb file contains the ruby ddl for each individual table all in one place in alphabetical order. If I’m doing a lot of model work I keep it open all the time. This also holds the definition of non-model tables; I’ll let you decide if that’s an advantage or a disadvantage. The plugin sounds cool, I’ll have to give it a go.

    2006-07-14
    112SUGGEST

    It seems a bit strange to have two download links for the same store.rhtml layout file on the same page. The first link seems a little premature since the discussion that follows the flash code snippet motivates the placement of that snippet within the layout code.

    2006-07-13
    176OK

    It would be nice to know which rails-version is required for respond_to.

    (Dave says: the book assumes the latest rails (1.1+)

    2006-07-13
    255ERROR

    … Alter natively, specifying
    add_column :orders, :placed_at, :datetime, :default => “now()”
    sets the default to the MySQL now( ) function

    This doesn’t actually work, at least with MySQL 5.0.18:

    — create_table(:payments)
    rake aborted!
    Mysql::Error: Invalid default value for ‘date’: CREATE TABLE payments (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `user_id` int(11) NOT NULL, `amount` int(11) DEFAULT 0, `date` datetime DEFAULT ‘now()’) ENGINE=InnoDB

    2006-07-14
    124SUGGEST

    “if msg” is not really necessary in redirect_to_index. A null flash :notice will not display in the store’s layout.

    (Dave says: true, but I still like to be explicit here)

    2006-07-13
    139SUGGEST

    Echoing the previous comment, there should probably be an arrow pointing to the added “has_many” line in the Product class, or the remainder of the class elided.

    2006-07-13
    19TYPO

    End of second last paragraph:

    possibly -> possible.

    2006-07-25
    133SUGGEST

    I would second the suggestion for a blind_down on empty_cart. empty_cart looks clunky compared to the blind_up’d add_to_cart. Hopefully the reviewer’s suggestions shouldn’t require too many changes to the existing text as no new concepts seem to be introduced.

    (Dave says: great idea for an exercise…)

    2006-07-15
    165SUGGEST

    I like the idea suggested by erratum #4023 for clearing the original uri, but the code presented in the erratum does not work for me. The session object does not appear to offer a single-argument delete method. I find I have to do something clunky like the following:

    original_uri = session[:original_uri]
    session[:original_uri] = nil
    redirect_to(original_uri || { :action => “index” })

    2006-07-13
    77SUGGEST

    right under figure 6.4, where the protected method appears, it is not entirely clear that the method should be contained within class Product.

    2006-07-15
    64SUGGEST

    I’m using rails via cygwin on Windows XP. When testing my database connection I was seeing an error saying “No such file or directory…” with a file name of mysql.sock, as explained in the 6th bullet on page 64. I eventually managed to fix it after looking at the following articles:

    http://wiki.rubyonrails.com/rails/pages/database.yml/versions/9
    http://blog.labnotes.org/tag/quickhacks

    The latter explains, “It turns out that connecting to localhost in the cygwin environment attempts to use Unix sockets. I run MySQL … as a Windows service, using NT pipes for local connections [note: as do I]. Similar concept, but not interoperable. The quick fix is changing localhoust to 127.0.0.1. With an IP address (or any name other than localhost), the client library uses TCP/IP instead.”

    I found these articles very useful in helping me to get up and running with rails, so it may be worth including this information in the “list of things to try if rails can’t connect to your database.”

    2006-07-15
    250TYPO

    “Developers (or database administrator) make” should read “Developers (or database administrators) make”

    2006-07-14
    254OK

    Though PostgreSQL is often abbreviated Postgres, it really should be PostgreSQL. (PostgresSQL stems from Postgres95 which stems from Postgres.)

    (Dave says: it probably should, but I’ll stick with the common usage. PostgresSQL is unpronouncable… :)

    2006-07-14
    261SUGGEST

    Does Rails always take responsibility for incrementing the value of the primary key? I’m pretty sure that it delegates any such responsibility to the database whenever possible (auto_increment in MySQL, serial sequence in PostgreSQL). In that case, it may be better to write “Rails ensures that the value of this column is incremented”.

    2006-07-14
    270SUGGEST

    Dropping the entire database just isn’t a feasible option in production environments — and it’s not entirely unthinkable that a certain migration did just fine in development trials but failed at the moment supreme. “You’ll have lost nothing” then seems a bit out of place. Simply mentioning that it only goes for development might prevent raising a couple of eyebrows.

    2006-07-14
    117OK

    “nondatabase” — should that have a hyphen?

    2006-07-13
    82OK

    Download depot_c/app/view/admin/list.rhtml is missing the ruby code to insert product.image_url into the tag. It’s in the text on the page, but not in the download.

    2006-07-13
    85OK

    There should be a download link for the first use of depot.css for Iteration A4. I was able to create it via the appendix.

    (There’s a download link at the top of the file in the appendix. I really don’t want to include the file inline at this point)

    2006-07-13
    82TYPO

    Sample code of depot_c/db/migrate/003_add_test_data.rb - in the description section, there’s a portion of italicized text that probably should not be. It’s in the line:


    version control: it’s a foundational piece of any project’s

    The text between the two single quotes is italicized.

    (Dave says: yes—our syntax highlighter has a problem with %{…} style strings. We’re all going to have to live with this, I’m afraid)

    2006-07-13
    261SUGGEST

    This page contains a reference to “sec.consolidate”, which doesn’t work. I hope you’re still writing that section and that’s why it doesn’t refer to anything.
    I’ve been working with migrations and I must say that I’ve often hated ending up with so so many of them. The automatically generated schema.rb file helps (you should mention that when you introduce the annotate_models plugin), but some automatic way to concatenate the migrations would be wonderful. This link seemed to promise an explanation of hoow to do that…

    2006-07-14
    263SUGGEST

    I read about the Data Migrations with interest, but I’m left wondering a bit when to use fixtures, when to use data migrations, and when to load fixture data in migrations. Maybe you could paint three scenarios that highlight when to use which, or just give some rules of thumb. I would assume one should use fixtures for test data and data migrations for “constant” data. For example, if there is a table that lists the types of credit cards that the system accepts, then that’s really “constant” and needs to be pre-loaded in all environments (dev/test/prod). When adding code to handle a new type of credit card the data migration going with it can add a new row to that table. Cheers & many thanks for a great book!

    2006-07-14
    176OK

    Please provide description on how to create test suite that links all integration tests together. Also, needed is the description to route the test results to a file so the user may access to this test log file at later time.

    (Dave says: just run rake test:integration and it runs them all. You can redirect outputusing your OS facilities for doing that)

    2006-07-13
    555DEFER

    Hi Dave:

    My understanding is that Rails is moving toward using plug-ins in favor for components. It would be very helpful if your book has a chapter devoting to how to use plug-ins.

    (Dave says: that’s a big topic, and the book has already grown far too big… :)

    2006-10-04
    181OK

    Hi Dave:

    In the testing chapter, it would not be complete if it does not include a detailed section in using the Rails debugger.

    (Dave says: I cover debugging later—testing is really a different topic)

    2006-07-13
    95OK

    Add a class method to the Product model to return salable items.

    (Dave say: I’m not sure what this report means)

    2006-07-13
    174SUGGEST

    You should consider mentioning which file you expect to insert who_bought.

    2006-07-13
    199TYPO

    The title ‘Dynamic Fixtures’ is missing the ‘t’

    2006-07-13
    0SUGGEST

    Hello! I think it would be great if you suggested Markaby as a template-handler (available as a plugin downloadable from http://code.whytheluckystiff.net/svn/markaby/trunk/ and documented at http://markaby.rubyforge.org/) in this second edition of AWDwR. Markaby enables to write views templates in pure-Ruby, thus providing a very clean and smart markup compared to eRuby. It might be quick but useful to explain how to write HTML templates with this wonderful plugin (although Markaby can be used in any Ruby script). Thank you for the brilliant books that you write.

    (Dave says: added as an exercise)

    2006-07-16
    259TYPO

    “If refactoring leads us to rename variable and columns” -> “If refactoring leads us to rename variables and columns”

    2006-07-14
    177TYPO

    depot>curl would look more consistent if there was a space between teh prompt and “curl”

    2006-07-13
    161SUGGEST

    maybe it was mentioned earlier in the book (I don’t think so), but it’s unclear if _field_tag functions will automatically do the necessary html escaping on the parameters they’re passed. ie, are malicious items passed via the query string going to get rendered as is in the elements? It would be nice to see this question addressed here, since it is the first time the_field_tag method is used.

    (Dave says: they don’t which why we call h() when displaying values later)

    2006-07-13
    164TYPO

    Have some grammar issues:

    “We show our customer and are rewarded with a big smile and a request. Could we add a sidebar and put links to the user and product administration stuff in it.” would read a lot better as something like “We show our customer and are rewarded with a big smile and a request: Could we add a sidebar and put links to the user and product administration stuff in it?”

    2006-07-13
    132SUGGEST

    So how do I get to RDoc? (footnote)

    (Dave says: changed it to say "Rails api documentation)

    2006-07-13
    170SUGGEST

    The line:
    cart = (session[:cart] ||= Cart.new) seems like it's either tricky or buggy. As far as I can tell, it both sets the session[:cart] to a new value if it's empty and assigns the new/existing cart to cart. If this is intended to set session[:cart], it seems like a pretty hacky (idiomatic?) way to do it. It seems like it begs an explanation.

    (Dave says: it is indeed idiomatic, and explained earlier in the book)

    2006-07-13
    153OK

    A footnote indicating why you don’t use the name “hash” for the hashed password field would be nice. I fell into this trap with the first ed. too!

    (Dave says: I’m not sure there’s a problem: hashed_password seems like a reasonable name for a hashed password. You could call it ‘hash’, and it would override the built in method with that name)

    2006-07-13
    118ERROR

    I’m building a cart and on page 118 it suggests that the ‘product’ method is being called inside the ‘add_to_cart()’ method which is causing a problem.

    ‘add_to_cart()’ never calls ‘product()’. I think ‘add_to_cart()’ should actually be ‘add_product(product)’ from the Cart class in cart.rb.

    2006-07-13
    252SUGGEST

    Is there meant to be an inconsistency in the way the generator is invoked on these two migration examples? The first example explicitly invokes the ruby interpreter, the second does not. The explicit invocation doesn’t seem to really be needed…

    (Dave says: it is for windows)

    2006-07-14
    17TYPO

    The sentence “The most common templating scheme, called rhtml embeds snippets…” should have a comma after “called rhtml.”

    2006-07-25
    22SUGGEST

    In the “Installing on Mac OS X”, it should be noted that all problems with ruby were fixed on 10.4.6, and a simply installing Gems an doing a “gem install rails” will do.

    (Dave says: despite this, I still install Ruby using DP, simply because it gives me more control)

    2006-08-20
    438ERROR

    There is no

    2006-10-04
    127SUGGEST

    I spent plenty of time tracing why ajax-changes didn’t work on my computer. Finally I solved problem by setting IE to check new version of every visit to page. I think you should add this list on that page.

    My problem was that development.log wasn’t really helping me.

    “Processing StoreController#add_to_cart (for 127.0.0.1 at ActionController::MissingTemplate (Missing template ./script/../config/../app/views/store/add_to_cart.rhtml):”

    (Dave says: I believe the new Rails timestamps address this)

    2006-07-13
    441TYPO

    The form_tag example on this page isn’t valid Ruby. E.g. type the given code into irb or script/console:

    >> form_tag { :action => :save }, { :class => “compact” }
    SyntaxError: compile error
    (irb):2: parse error, unexpected tASSOC, expecting ‘}’
    form_tag { :action => :save }, { :class => “compact” }
    ^
    (irb):2: parse error, unexpected ‘,’, expecting $
    form_tag { :action => :save }, { :class => “compact” }
    ^

    A Ruby method call with multiple hashes like the above requires parentheses around the parameters, so the example on this page should be:
    <%= form_tag( { :action => :save }, { :class => “compact” } ) %>

    Here’s a link that breaks this issue down with a bit more detail:
    http://muness.blogspot.com/2006/04/multiple-hashes-as-parameters-in-ruby.html

    2006-10-04
    516SUGGEST

    ‘ActionMailer does not deliver e-mail in the test environment. Instead, it appends each e-mail it generates to an array.’

    It might be worthy to note that in the development environment, delivery is set to :smtp by default. I find it convenient to use the :test delivery and pop the most recent email off ActionMailer::Base.deliveries in my view.

    2006-10-09
    380TYPO

    Missing closing parenthesis from the last sentence on the page: “The fix is either to relax the rule (making the leading zero optional in the requirement with [0-3]?\\d or to make sure you pass in two-digit numbers.”

    2006-07-25
    255ERROR

    :datetime cannot use “now()” as a default in MySQL 5.0. A MySQL column of type Timestamp can use CURRENT_TIMESTAMP as the default, but Rails turns :timestamp into a DateTime column.

    Is the only / best way around this by manually adding an execute to the migration? This seems like something that will need to be addressed.

    2006-07-14
    462TYPO

    Second-to-last line has

    2006-10-04
    174OK

    I’m getting an error
    —————-
    ActiveRecord::HasManyThroughAssociationNotFoundError in InfoController#who_bought
    Could not find the association :line_items in model Order
    —————-
    when I try to access the Action who_bought at

    myserver.com/info/who_bought/1

    (Dave says: do you have ’has_many :line_items" in your order model?)

    2006-07-13
    152OK

    The iteration Task E: Shipping present in the 1st ed is missing from the 2nd edition. Does this reflect a missing chapter in the process of a re-write? Or did our “client” decide that shipping orders was no longer important? ;)

    (Dave says: it’s gone from this edition. It doesn’t teach enough new stuff)

    2006-07-13
    131OK

    Iteration D4: To know when to reveal the cart with the blind down effect, we’re querying cart.total_items. We need to write this. The implementation you show calculates the total of the items. Instead, return items.length.

    (Dave says" No, you need the total number of items, not items.length, because you only reveal when the first product is added to the cart. Add the same product twice, and there’ll still be just one item)

    2006-07-13
    190OK

    The test on this page (test_unique_title) would also fail because the image URL is invalid. Perhaps it would be clearer (and more appropriate for reader experimentation) if the example contained a valid image URL (i.e. one beginning with http://).

    (Dave says: the model only looks at the suffix when validating)

    2006-07-13
    130OK

    The change to the _cart.rb partial should come with a link to source code just like the others.

    (Dave says: this isn’t in the code base. It’s bad code)

    2006-07-13
    140TYPO

    Just before the section entitled “Creating the Order Capture Form,” the last sentence should read “relationships starting in Section 17.6….”

    2006-07-13
    149TYPO

    First sentence of last paragraph should read, "… but rjs doesn

    2006-07-13
    3TYPO

    (And if you

    2006-07-25
    167TYPO

    “Sure enough, our user is removed, and an empty list is displayed.”

    The login page is displayed instead. After the last user is deleted, session[:user_id] does not match any user in the database, and so the redirect to list_users is not authorized.

    (Dave says: good catch)

    2006-07-13
    187TYPO

    End of 2nd paragraph: “…useful to diagnosing what went wrong” should be “…useful for diagnosing what went wrong.”

    2006-07-13
    159OK

    On page 159 of the pdf (or page 171 depending) you show the resulting ‘add user’ form, also on page 158 you make a reference to this form as well. But in both cases the form looks very different because just a stub exists at this point.

    It may be helpful to let the user know that this code can be found on page 165, as I was left wondering and had to skip ahead from 11.1 to 11.4 in order to find it.
    (Dave says: I’m not sure what’s missing: it comes up looking exactly like this for me)

    2006-07-13
    122OK

    Figure 9.1 doesn’t match the text at the bottom of the page. The text mentions that upon adding something to your cart you should see a page like in Figure 9.1, but Figure 9.1 shows the index page rather than the add_to_cart page which is then fixed by changing store_controller.rb on the following page. Either don’t mention the figure until the following page or fix the figure.

    (Dave says: “if you display the catalog after adding an item to your cart”)

    2006-07-13
    104OK

    <%= @content_for_layout %> should be <%= yield %> according to http://weblog.rubyonrails.com/2006/04/25/use-params-not-params/

    (Dave says: That weblog entry is incorrect)

    2006-07-13
    95ERROR

    The footnote on this page states that because it uses an HTML form, button_to() can’t be used in-line the way link_to() can. However, with the proper CSS setup, it IS possible to run this type of element in-line.

    2006-07-13
    99SUGGEST

    Very bottom of PDF-page 99:
    [Original]
    in the store controller. A simple implementation would be
    [Suggested]
    in the store controller. An example of a simple implementation would be
    [Reason]
    While reading the text I suddenly panicked, not knowing with file was being edited. Only after reading further did it occur to me that this was just an example.

    2006-07-13
    195TYPO

    Test::Unit does not have ‘assert_not_match’. It is ‘assert_no_match’. I guess this could be called a typo, but it’s a pretty important one, so I classified it as a “Technical Error”. :) It only cost me about 3 minutes, so not too bad.

    2006-07-13
    215TYPO

    Last full sentence on page begins, “For this reason, its normally a bad idea…;” “its” should be “it’s.”

    2006-07-13
    216TYPO

    Under point #2, you write, “A common example of this kind of problem are database-related performance issues.” “are” is wrong here; use “is” instead, since the verb modifies “example” and not “issues.”

    2006-07-13
    107TYPO

    Fourth paragraph after “The Moral of the Tale”…

    “include a include Reloadable directive” should be “include an include Reloadable directive”

    2006-07-13
    7OK

    Under “Testing” you say that some of the testing code from the 1st edition was broken by the release of Rails 1.0. Do you rather mean Rails 1.1? I don’t know if the 1st edition was published before Rails 1.0 or not, but prior to this statement, you were discussing changes in the 2nd edition pertaining to Rails 1.1.

    (Dave says: no, it was broken by 1.0. The book went to press before 1.0 came out, and they made the change after)

    2006-07-13
    172SUGGEST

    In this chapter, we

    2006-07-13
    598SUGGEST

    I am writing unit tests for the first time. I went to the back of the book to see the complete Depot app but the tests aren’t there :( Please include them.

    2006-07-21
    450SUGGEST

    When using the example I run into trouble with my images being truncated. It turns out that mysql’s BLOB is limited to 2^16, which wasn’t enough for my images.

    I had to use something like:
    add_column :products, :image, :binary, :limit => 1.megabyte

    in my migration to make rails use MEDIUMBLOB for binary instead of BLOB.

    This is not an error in the text, but a simple note might save a lot of time for people like me. It took me a while to figure out where was the mistake.

    (Dave says: great tip!)

    2006-10-04
    169ERROR

    The logout method is listed as:

    def logout
    reset_session
    flash[:notice] = “Logged out”
    redirect_to(:action => “login” )
    end

    This will correctly log the user out, but the flash is never seen. Resetting the session kills the old session. With no session available, I believe that flash[:notice] will generate a new FlashHash outside of any session. But then a new session is created with the redirect. And the flash is never seen by the browser (same behavior with Firefox and IE6).

    Changing this to “session[:user_id] = nil” will log out the user but keep the rest of the session intact.

    2006-07-13
    292OK

    order = Order.find(:first,
    :conditions => “name = ‘Dave Thomas’”,
    :order => “id DESC”)

    one the last example in the middle section, find(:first) will only ever return one value, so including and :order => “id DESC” won’t have any effect. Right? Consider changing to find(:all) ?

    (Dave says: nope—it makes a difference. It determines what the database considers to be the first row)

    2006-07-14
    82SUGGEST

    I think that you should emphasize the “rake db:migrate” command that should be run by formatting it the same as previous commands. It is easy to skip over because the reader is used to seeing all command formatted the same way.

    2006-07-13
    89SUGGEST

    You use this line on this page: find(:all, :order => “title”)
    This would be a good time to mention that :order => “title” means order by title. I’m not sure if this has appeared yet in the text, and it may be obvious to many readers, but is still worth mentioning.

    2006-07-13
    104SUGGEST

    just for nit-picking, the error image in figure 8.1 shows different code than what you’ve told the reader to enter (cart_item vs. item). I was getting a different error and I didn’t know why (undefined variable or method because of an “item” in the for statement instead of a cart_item)

    2006-07-13
    225TYPO

    In the lib/ section, first sentence: “The lib/ holds application code…” should read “The lib/ directory holds application code….”

    2006-07-14
    198OK

    Your test_index_without_user includes:

    assert_redirected_to :action => “login”

    This fails for me, due to a difference in the returned redirect. Earlier on the page you show that the login_controller uses:

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

    In order to get this test to pass, the asserted redirect had to match:

    assert_redirected_to :controller => “login”, :action => :login

    (Dave says: it works fine here: looking at the source of assert_redirected to, it seems only to check the controlled if you specify one)

    2006-07-13
    155OK

    Hi,

    you call a method named “self.find_by_name”. Also you call in “controller/application.rb” the method: User.find_by_id

    But in the user model there is no method created called find_by_name or find_by_id. Did you miss something? please correkt me if i’m wrong. But the session won’t work without these methods.

    (Dave says: it’s a dynamically constructed finder method. I’ve added some text to describe what’s happening)

    2006-07-13
    35TYPO

    The string “Download work/demo1” amid references to “demo” without the 1. Apologies in advance if my noob is showing.

    (Dave says: the 1, 2, 3 are verions of the code, and demo is the overall name)

    2006-07-25
    445TYPO

    those model’s
    should be: those models’

    2006-10-04
    441TYPO

    “Looking at the .rthml file in Figure 20.2…” should be “Looking at the .rhtml file in Figure 20.2…”

    2006-10-04
    146OK

    “Next, on line 5, we tell the order object to save itself (and its children, the
    line items) to the database.” After reading this, I tried following the code and it is unclear to me where or how the array of line_items is being held for saving. I was expecting that the result of add_line_items_from_cart should be put somewhere like @order.line_items, but it just looks like magic. It would be helpful to clarify how these model child items work.

    (Dave says: I’ve added a note to say it’s defined in the next paragraph)

    2006-07-13
    149SUGGEST

    While the response to Joe’s inquiry into credit card processing seems reasonable for a short intro to rails, it sure would be nice to have a brief tutorial in the appendix on how one would go about using either of the two suggested methods. (the developers skimped a little on their readme’s)

    (Dave says: to be honest, it’s a book in its own right. I don’t have the space to do this here)

    2006-07-14
    143OK

    fieldset should be inside the form tags.

    (Dave says: I checked with the W3C spec, and I don’t see that for HTML4 strict)

    2006-07-16
    170SUGGEST

    “We moved some application-wide controller helper methods into the
    ApplicationController class in the file application.rb in app/controllers.” So far there is only one method in application.rb, but the text hints at plural methods. Also, the method was just created there, not moved.

    2006-07-16
    168OK

    No matter what I try, I can’t get the user deletion transaction to roll back properly. safe_delete throws an error (I set User.count == 1 to test it, deleted a second user, and received the error message in the view), but the user row gets deleted anyway. Any thoughts?
    I am using:
    XP Professional (for development)
    Ruby 1.8.4
    Rails 1.1.4
    WEBrick 1.3.1
    MySQL 5.0.21

    (Dave says: are you using a transactional database engine inside MySQL: MyISAM isn’t)

    2006-07-16
    149OK

    The download for the add_to_cart.rjs file is from the “depot_r” set. However, previous downloads in this Chapter 10 are from the “depot_p” set, as are downloads in the first part of the next Chapter -> this could be confusing if you’ve downloaded the full source code set (rather than individually).

    (Dave says: sorry—that’s just where the source is…)

    2006-07-15
    243SUGGEST

    The p method in the example for in_groups_of is unclear (esp. to those of us just coming to Ruby — I thought it was a variable). It would be good to have a footnote about it or a short explanation, since this is a tricky term to try and google.

    2006-07-25
    156OK

    You use the idiom ‘self.attribute=’ when setting instance attributes in the password and create_new_salt functions. Setting instance attributes in this way is not, to my knowledge, common among Ruby programmers; it’s certainly not discussed in the Pickaxe book (2d ed.). It’s my understanding that the accepted way to set instance variables is via ‘@attribute=’. If there’s a difference between the two idioms, here would be a good place to explain it.

    (Dave says: @fred = assigns to the instance variable. self.fred = invoked the attribute setting method)

    2006-07-15
    89OK

    In index.rhtml: I found I needed to add a   after the <%= product.price %> code in order to get the same layout as Fig 7.2. I was using the supplied test data, and the generated html looked correct without the  

    Without the   my browsers (Firefox 1.0.7 & Konqueror 3.4.3-0.fc3.3) both put the price below the entry’s border-bottom causing the entry below to be offset from the beginning of the line.

    CSS/HTML problem or browser rendering bug? I don’t know…

    (Dave says: it is formatting fine here. I wonder if you have

    tags around your product descriptions (I have in this code))

    2006-07-25
    347ERROR

    find_by is not an instance method; it is a class method. You’ll need to change self.find_by_name in the validate_on_create function to User.find_by_name.

    2006-07-25
    136OK

    Using a model named Order has the potential to interfere with the reserved SQL word ORDER. I didn’t encounter an issue in the context of the code presented in the book, but in some work I’ve done in an app that leverages the depot models and table relationships. I ran into an issue where I started getting SQL errors from MYSQL 4.1.20 while trying to sort a nested Scaffold table my product name (Order table, expand Line Items under order, sort Line Items by product name) using the Product has_many :orders, :through => line_items relationship. I can’t fully explain what exactly triggered it, but once I changed the model Order to StoreOrder, it worked fine.

    (Dave says: the word ‘order’ should never leak into the SQL—it will be ‘orders’ by the time it gets there. I suspect you have some other problem)

    2006-07-16
    190SUGGEST

    Because the code for test_unique_title1 wraps onto page 191 and the “Figure 13.1 Standard Active Record validation messages” begins on page 191. It looks like the validation messages are part of the test_unique_title1 code.

    It would be great if the seperation were more clear. (maybe move the figure to a different page?)

    (Dave says: we do all layout at the end)

    2006-07-16
    452SUGGEST

    In the file show.rhtml (bottom of page), I almost fell off my chair when I saw the argument to ‘src’; there were unquoted double quotes inside the string! There were random thoughts concerning the inclusion of untested code etc. Oh well, I’ll do it right and send an errata later. Really? Yes, really!

    However..
    Quoting the double quotes did not work, but changing them to single quotes did. This bothered me, so when I had the rest of the upload working (including changing blob to longblob to accomodate modern size images), I tried the example and it worked. I assume this is due to the expansion inside "<% .. %> taking place first.

    Suggestion:
    Either change to single quotes so parser brains like mine don’t balk or add a footnote explaining why this works. Reading it still bugs me :-)

    2006-10-04
    452SUGGEST

    Add a reference to caching techniques to the last sentence “…by caching the picture action.” I’m reading the PDF version (just love it) and was disappointed to find no reference and no continuation if this on next page.

    2006-10-04
    75OK

    You make the point a few times that changes to rails or the database show up instantly when we refresh the browser, but this is a common trait of applications written in scripting languages. Is there some sort of caching that would normally take place with rails? The reason for the impressiveness is unapparent.

    (Dave says: only true if you’re writing CGI scripts, which reloads on every request. Rails is not a CGI environment)

    2006-07-21
    158SUGGEST

    I had some difficulty understanding the add_user action. Specifically, the line: user = User.new. After some playing around I figured out (I think) that this line clears the form if the user.save succeeds, but it took me a long time of thinking that I was just missing something that I had already been told. A line in the text that explains this would be great!

    2006-07-25
    209TYPO

    “Finally … make sure we’ve created a order” - should be AN order

    2006-07-25
    154OK

    (Ruby Nuby suggestion) Explain the use of “self” in variables. Previously self was used to define class methods. Here it appears that self.salt is an instance variable; is that so? and if so how is it different from @salt?

    (Dave says: nope—it’s still a method call)

    2006-07-21
    253ERROR

    “After the last migration has been applied, the version in the
    schema_info table is updated to its sequence number.” — Really? It doesn’t update the schema_info table after each migration is applied? Your description of backward migrations is incremental, but forward migrations only logged when the entire process is complete?

    (Dave says: you’re right—the number is updated for each one)

    2006-07-25
    245SUGGEST

    All this stuff about how to fix the shortcomings of Rails plurals is great, but I had to go to the Rails Wiki to find out where to actually put it to make model generation go smoothly (environment.rb in the config directory). (It seems that Rails thinks the plural of “cactus” is “cactus” rather than either of the two accepted English plurals.)

    2006-07-25
    217OK

    I had to set my fixture path to:
    self.fixture_path = File.join(File.dirname(FILE) + “/../../fixtures/performance”) to get the YAML file to work, and i also had to change,
    require File.dirname(FILE) + ‘/../../test_helper’

    (Dave says: you have a ‘+’. It should be ‘,’ as in the book)

    2006-07-25
    126ERROR

    I bumped into the same problem with the page[:cart].replace_html call not working in rails v 1.1.4. That format yields code like this: ‘$(“cart”).update(etc…)’ whereas the page.replace_html(‘cart’) call returns this js code: ‘Element.update(“cart”,etc…)’ and the changes are displayed correctly in the browser.

    2006-08-27
    130OK

    I was able to get the highlighting effect to work with this code (rails 1.1.4):

    page.visual_effect(:highlight, “current_item”, :startcolor => “\\”#88ff88\\“”, :endcolor => “\\”#114411\\“”)

    the hex values have to be quoted or firefox 1.5 will complain about the # sign being an illegal character

    (Dave says: this works with the Rails I’m using, so I assume this was a Rails bug)

    2006-09-04
    39SUGGEST

    When working on rhtml files I love to use dreamweaver.

    As a suggestion http://www.ridingtheclutch.com/entry.cfm?id=58
    is a plugin into dreamweaver to have it support the rhtml commands.

    Was very nice during som applications.

    2006-08-20
    xiiTYPO

    The name of the french doctor who you have taken the sentence “Tous les jours, a tout point de vue, je vais de mieux en mieux” is not spelled "Coul

    2006-07-25
    130SUGGEST

    If typing in all the code, watch out for adding an extra ‘,’ after “#114411”. It was very hard to debug this…:)

    2006-07-25
    205SUGGEST

    Page 205 at the section about @assigns. I think this is too vague and it needs some more work. It could benefit from some more examples here. Here’s my suggestion below.
    NOTE: that i have not tested the code, but I expect you to use these as examples for improvement.


    assigns(key=nil)
    Instance variables that were assigned in the last action.
    assert_not_nil assigns[“items”]
    assert_equal 2, assigns[“items”].size
    The assigns hash must be given strings as index references. For example, assigns[:items] will not work because the key is a symbol. To use symbols as keys, use a method call in stead of an index reference.
    assert_not_nil assigns(:items)
    #=> symbol :items set in controller
    assert_not_nil assigns(:products)
    #=> symbol @products set in controller

    It’s then possible to test further on the contents of your variables in the code:
    assert_equal 3, assigns(:products).size
    #=> 3 books for sale

    2006-07-25
    206SUGGEST

    Please give examples (note the plural form!) for ALL functional testing helpers, including:

    find_all_tag(conditions)
    follow_redirect()

    2006-08-27
    202SUGGEST

    Please give examples (note the plural form!) for ALL assertions, including:

    assert_dom_equal(expected_html,actual_html,message)
    assert_dom_not_equal(expected_html,actual_html,message)

    2006-08-27
    201SUGGEST

    Please give examples (note the plural form!) for ALL HTTP request methods, including:

    xhr(method,action,parameters,session,flash)
    xml_http_request(method,action,parameters,session,flash)

    post()
    especially because post is very different from get in this context. show how parameters are posted (and also include an example with nested parameters (we use it all the time in controllers):
    post :search, :employee => {:pattern => ‘programming’}

    2006-08-27
    221OK

    A full table of all test assertions would be much appreciated.
    It turns out that it’s hard to find anywhere else. Rails api documents only the added assertions, and the Ruby core api has no documentation of them.

    So a collection here would be much appreciated.

    (Dave says: I believe I give all the useful ones)

    2006-08-27
    194SUGGEST

    Please give examples (note the plural form!) for ALL assertions in the section “Unit Testing Support”

    2006-08-27
    110OK

    The link to file depo/app/controllers/storecontroller.rb is one version too refined. In other words, it has the next update to this file’s code already included.

    (Dave says: that happens sometimes…)

    2006-07-25
    208TYPO

    Line 2: “…let’s load it into a load variable.” — I think you just mean “let’s load it into a variable”.

    (Dave says: changed to “local”)

    2006-07-25
    332ERROR

    One-to-Many Relationships diagram says:
    has_many :invoice
    instead of:
    has_many :line_items

    2006-07-25
    282TYPO

    "It know that it

    2006-07-25
    354TYPO

    In the footnote you have:
    Unless you use ask your database to enforce foreign key contraints.

    Should be:
    Unless you ask your database to enforce foreign key contraints.

    Sans ‘use’

    2006-07-25
    346TYPO

    Currently:
    However, we

    2006-07-25
    281TYPO

    wrpas should be wraps (2nd line of last para)

    2006-07-25
    292TYPO

    Paragraph 2, line 4: “withing th” should be “within the”

    2006-07-25
    302TYPO

    Under :from, “let’s” should be “lets”

    2006-07-25
    306TYPO

    with_scope.rb:1: Is it deliberate that object dave is created with name Ned?

    (Dave says: no… :)

    2006-07-26
    93TYPO

    knopwledge

    2006-07-25
    311TYPO

    Last word of first para under Counting: “paramters” should be “parameters”

    2006-07-25
    261TYPO

    Near bottom of page, “incompatibilities between difference databases” should be “incompatibilities between different databases”.

    2006-07-25
    288TYPO

    You are talking about the installation of different database adapters. To install firebird, you say do a “gem install fireruby”, and in the section about installing frontbase you say to do a “gem install fireruby” which is, according to the text, the “ruby-frontbase package”. :)

    (Dave says: thanks. It’s gem install ruby-frontbase)

    2006-07-25
    168TYPO

    User.login in the sidebar for Friendlier Login System should probably be User.authenticate. user.rb does not have a login method.

    Bill

    2006-07-25
    74OK

    Tried to enter the tutorial code, got the following:
    rake —trace —verbose db:migrate
    (in /Users/albee/Development/Languages/Ruby/RubyOnRails/trunk/work/depot)

    Invoke db:migrate (first_time)

    Invoke environment (first_time)

    Execute environment

    Execute db:migrate
    AddPrice: migrating ==
    — add_column(:products, :price, :decimal, {:precision=>8, :scale=>2, :default=>0})
    rake aborted!
    You have a nil object when you didn’t expect it!
    You might have expected an instance of Array.
    The error occured while evaluating nil.[]
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:259:in `type_to_sql’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:122:in `add_column’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:272:in `method_missing’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:256:in `say_with_time’
    /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:256:in `say_with_time’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:270:in `method_missing’
    ./db/migrate//002_add_price.rb:3:in `real_up’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:210:in `migrate’
    /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:210:in `migrate’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:332:in `migrate’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:327:in `migrate’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:294:in `up’
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.3/lib/active_record/migration.rb:285:in `migrate’
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.4/lib/tasks/databases.rake:4
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute’
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute’
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke’
    /usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize’
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke’
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run’
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run’
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
    /usr/local/bin/rake:18

    Looking at the ActiveRecord::Migration docs, decimal is not an allowed type.
    Replacing it with float at least works around the error.

    I’m using Rails version 1.1.4, and ActiveRecord version 1.14.3.

    (Dave says: you need edge Rails to use the Decimal stuff)

    2006-07-25
    313SUGGEST

    Maybe you can write a sentence on the difference between find_or_create_by and find_or_initialize_by. One of them does save the object back to the database, the other only creates the object, right?

    2006-07-25
    316TYPO

    save, save!, create, and create! :
    “saves” instead of “saved”

    2006-07-25
    370TYPO

    2nd sentence in 1st Para: “Thi” instead of “This”

    2006-07-25
    276TYPO

    The last paragraph before 16.7 starts with “All this discussion suggests that migrations are dangerous to us on pro-
    duction databases.” Should it be “… dangerous to use”?

    2006-07-25
    100ERROR

    In the instructions for setting up sessions in the database, the code from environment.rb changes from

    1. Use the database for sessions instead of the file system
    2. (create the session table with ‘rake db:sessions:create’)
    3. config.action_controller.session_store = :active_record_store

    to

    1. Use the database for sessions instead of the file system
    2. (create the session table with ‘rake create_sessions_table’)
      config.action_controller.session_store=:active_record_store

    (note the difference in the second line, the rake command)

    2006-07-25
    82OK

    I DL’ed 003_add_test_data.rb from your website and tried to use it to load the test data. That version of the script has the prices in decimal dollars instead of cents. It (silently) fails the “numericality_of” validation so no data gets loaded. I changed the prices to integers and everything worked fine.

    (Dave says: you need edge Rails to use the Decimal stuff)

    2006-07-25
    82SUGGEST

    In the intstructions to download the images and stylesheets, you say to put them in their “corresponding places” but there’s never been a discussion of the public directory and its subfolders which is where they go.

    2006-07-25
    131ERROR

    Paragraph 9.4, the _cart partial listing displays ‘format_price(cart.total_price)’ it should be ‘number_to_currency(cart.total_price)’

    2006-07-25
    248TYPO

    “Rails also extends Enumerable with two other methods. index_by( ) It takes a collection and converts in into a hash where the values are the values from the original collection. The key referencing each value is determined
    by passing that element to the block.”

    The “index_by() It takes…” is a little awkward. And “converts in into” has a typo.

    2006-07-25
    290TYPO

    the header “DB2 Adapter” is on the section describing the installation and configuration of the Openbase adapter

    2006-07-25
    74TYPO

    In the first sentence of the paragraph beginning “The :precision argument” I think you want “two” instead of “thwo”

    2006-07-25
    342TYPO

    orders.length is described twice—before and after orders.empty?

    2006-07-25
    342TYPO

    In description of orders.size:
    “If you’ve already loaded the association (by access it)”
    the “by access it” part doesn’t look right (maybe that’s just my limited knowledge of English).
    Should it be “by accesssing it” or “by access to it”?

    2006-07-25
    346TYPO

    Second to the last paragraph:
    “tells Active Record to go though”

    Shoud be:
    “tells Active Record to go though”

    though -> through

    2006-07-25
    349TYPO

    Second sentence in the “Sharing Association Extensions”:
    “…in a Ruby module and passing that model…”

    model -> module

    2006-07-25
    93TYPO

    In the footnote: ontent_for_layout should be content_for_layout

    2006-07-25
    118TYPO

    Under Playtime, the second bullet begins “Pass this counter to you template” that should be “your template”

    2006-07-25
    178TYPO

    We

    2006-07-25
    333TYPO

    The various linkage declarations (belongs_to, has_one, and so one)
    *and so one) -> and so on)

    2006-07-25
    336TYPO

    bottom of page:
    (which is Ruby is treated as false). This let

    2006-07-25
    324TYPO

    “… is falling into disue are the basic …” - are should be as

    2006-07-25
    328TYPO

    2nd para “… the way THE report errors.” - last the should be they

    2006-07-25
    328TYPO

    create method - “… regardless of WHTHER …” - should be whether

    2006-07-25
    328ERROR

    In talking about the save!() method, you first say it raises a RecordNotSaved exception when unsuccessful, then later on the page you mention it raises a RecordInvalid exception if the object could not be saved - which one is it, or be more specific about particular exceptions if they’re both possible (I’m not sure for now as a newbie)

    (Dave says: different exceptions can be raised depending on circumstances. I’ve had to punt on this)

    2006-07-25
    283TYPO

    Last paragraph of the page:

    2006-07-25
    349TYPO

    last sentence on the page : “polymorhpic associations” should be “polymorphic associations”

    2006-07-25
    223ERROR

    It says “Our performance test runs fine…” but there’s missing how to run the test. It should say (just above “Our performance test…”. (example text feel free to change):

    Obviously, the performance test doesn’t run with “rake test”, so we have to start it manually from the command line:
    $ ruby ./test/performance/store_controller_test.rb

    2006-07-25
    289ERROR

    :password => “optional”, #defaults to ‘root’, should be on the above line :username => “optional”, #defaults to ‘root’

    2006-07-25
    337TYPO

    “has_one many more options” needs a HAS between has_one and many

    2006-07-25
    348TYPO

    “… letting our caller detmine the …” detmine should be determine

    2006-07-25
    349TYPO

    2nd para - “… applies to all the association declations” - last word should be declarations

    2006-07-25
    349TYPO

    Ist para for Section 18.4 “Relational database allow us …” should use databases (i.e. plural form) or reword sentence so singular form is OK

    2006-07-25
    355TYPO

    Last paragraph suggest making it start with "Now THAT we have …

    2006-07-25
    370TYPO

    First sentence has “… how to connection to …” - should be connect

    2006-07-25
    392TYPO

    2nd para “(Make sure you database …” should have YOUR not you

    2006-08-23
    26SUGGEST

    Regarding your suggestion of setting up a CI system. This is the first time I’ve ever heard of such a system, and so it would be nice if you could provide a link or two detailing what such a system is (in greater detail) and also maybe a few recommendations. Thx…Bob

    (Dave says: I’m nervous about doing this, as the area is changing fairly fast)

    2006-07-25
    74OK

    in the code block starting with “class AddPrice < ActiveRecord::Migration”, I first typed this in verbatum and got an error when subsequently running rake db:migrate. After checking the Rails API, I believe the third argument to add_column should be :float not “:decimal”. If I use :float, the example works.

    (Dave says: you need edge Rails to use the Decimal stuff)

    2006-07-25
    140SUGGEST

    I’m not too sure of the phrase “we can retrieve its order by name”. Technically, it’s retrieved by its ID, not its name, which, btw, is the customer’s name. I think the sentence should drop the “by”, becoming something like “we can retrieve its order’s name” or “…order’s customer name”.

    2006-07-25
    143TYPO

    Footnote: “and make the orders column a foreign key” doesn’t make sense. “orders” is a table, not a column anywhere. I guess you meant to say “and add a column with a foreign key… to the orders table.”

    (Dave says: it should say "make the payment type column….)

    2006-07-25
    147SUGGEST

    Code blocks lack the line numbering formatting on the left margin; this is not uncommon through the book, and sure is not very useful for small code blocks, but since the text below refers to “line 4” explicitely, it wouldn’t hurt to add the formatting directive for it in the book’s source.

    2006-07-25
    133OK

    In the paper there is displayed:

    redirect_to_index, but it should get a parameter like redirect_to_index(“”)

    (Dave says: the parameter is optional)

    2006-07-25
    103OK

    On page number 103 when talking about the template its written “(We’ll tart it up…)” It seemed like tart should be start.

    (Dave says: to “tart something up” is to decorate or make more attractive)

    2006-07-25
    288SUGGEST

    Hi, the DB2 Adapter provided by IBM should be referred to as IBM DB2 in order to distinguish it from the community one. This is reflected in the connection parameters too where it’s ibm_db2 and not db2 only.

    2006-07-25
    287SUGGEST

    You mention compound primary keys are not supported, but there is a module that attempts to do so here: http://rubyforge.org/projects/compositekeys/ - perhaps you could add a footnote linking to that page

    2006-07-25
    308TYPO

    2nd line, explcitly should be explicitly

    2006-07-25
    360TYPO

    Figure 18.3: Methods Created by Relationship Declarations seems to be out of place. It appears out of context in the middle of an Acts As discussion.

    2006-07-25
    42TYPO

    If you think about it, the
    original file contains a end-of-line character…

    should be

    If you think about it, the
    original file contains an end-of-line character…

    with “an” instead of “a”

    2006-07-26
    52TYPO

    “…and thn write the collesponding…”

    should be

    “…and then write the corresponding…”

    2006-07-26
    251SUGGEST

    First sentence of sec 15.4: “Integers gains…”. Use “Integers gain …” or “Integer gains …”

    2006-07-25
    305TYPO

    Many applications impose contraints on what.

    Many applications impose CONSTRAINTS on what. (just a missing s)

    2006-07-26
    305TYPO

    The with_scope machanism lets

    The with_scope MECHANISM lets

    2006-07-26
    153SUGGEST

    When using validation helpers for the User model, isn’t it redundant to include validates_presence_of :password and :password_confirmation when you already have validates_confirmation_of :password? I can’t think of a situation where you would get a different result by leaving out validates_presence_of :password_confirmation, unless it’s simply for a specific error message. DRY?

    2006-07-27
    29SUGGEST

    Include the driver ibm_db2 (the official one produced by IBM).

    http://www.alphaworks.ibm.com/tech/db2onrails?open&S_TACT=105AGX01&S_CMP=TILE

    I’m working with this, and if you wish can offer some hints and tips for building and using it.

    (Dave says: referenced now)

    2006-07-27
    356TYPO

    First line of text on page: “The key here are…” should be “The key here is…”.

    2006-08-23
    261SUGGEST

    In description of “:limit => size” I suggest “This basically appends the string (size) to the column type when creating the column.”

    2006-07-27
    656SUGGEST

    I second the suggestion of having Index as a top-level bookmark. In fact, I don’t see it in my bookmarks at all!!

    (Dave says: it’s listed under Appendices)

    2006-10-18
    92OK

    Code listing here has line numbers which makes copy/pasting harder, other code listings (so far) don’t seem to have that

    (Dave says: click and link and download the code)

    2006-07-27
    281TYPO

    2nd last line of page “…rather that…” should read “rather than”

    2006-08-23
    93TYPO

    Section 7.3, 4th paragraph:
    "Instead, let

    2006-07-27
    621OK

    You show how to use the variable @page_title in views, but it’s not showed how it’s set in the controller.

    (Dave says: the rest of the book shows that)

    2006-10-04
    84TYPO

    Prior to this page you should remark that the CSS and the description markup still need to be “turned on”. I spent some time at this point trying to figure out why my List page did not reflect these items, only to find out on subsequent pages that these items would be enabled later.

    2006-08-20
    153TYPO

    In “Playtime”, tracing the flow : “enw fidls” should probably be “new fields”, in “if you change something, for example by adding a enw fidls to a cart item, does that change ripple through the code?”

    2006-08-22
    168ERROR

    In “A Friendlier Login System”, login method : I think “redirect_to(session[uri] || { :action => ”index" })" should be : “redirect_to(uri || { :action => ”index" })", since we defined uri = session[:original_uri]. This redirection works for me now.

    2006-08-27
    114OK

    But if instead of using “wibble” as a bad product id you use “3wibble”, the program acts as if you used "3 as the product id. You might want to catch this error.

    (Dave says: true, but not really what I want to illustrate at this point)

    2006-08-20
    261TYPO

    Second last paragraph mentions “precision and :scale” parameters, but precision lacks a leading ‘:’

    2006-08-23
    296TYPO

    In the “Dave Says” box
    Person.find(:first,:condition=>"name=

    2006-08-23
    277TYPO

    In the run_with_index example at top of page, you call connection.add_index but the ActiveRecord connection object is missing in the call to remove_index.

    2006-08-23
    0SUGGEST

    Two friends of mine who are learning rails through the beta book have both gotten stuck on the fact that they need edge rails to run the samples. In both cases, they were getting frustrated because the samples didn’t work and they didn’t realize that that needed edge rails (actually neither one knew what edge rails was until I explained it to them). Please make this clearer.

    2006-07-28
    171TYPO

    In line 2 it should read “controller”

    “Adding a test to the controlled finds this case and
    ignores the request.)”

    2006-08-22
    171TYPO

    In line 8 it should read “authentication”

    “When the next request came in, the authenication failed,…”

    2006-08-23
    79TYPO

    “Note that before we compare the price to zero” should really talk about less than one cent. There is another reference to zero at end of the paragraph.

    2006-08-06
    89OK

    In first paragraph:

    …’here we

    2006-08-20
    185TYPO

    - If you like the progrmmatic generation of HTML responses…

    2006-08-22
    185TYPO

    Two “the”s in this context

    Add credit card… content management, and so on the the Depot application.

    2006-08-22
    330OK

    line 4 - divine the relationships “divine” should be “define”

    (Dave says: divine is correct)

    2006-08-05
    236TYPO

    particular Subversion revsion number -> revision

    2006-08-20
    93TYPO

    Footnote has two typos:
    1) “ontent_for_layout" instead of "content_for_layout”.
    2) “resonably” instead of “reasonably”

    2006-08-20
    193SUGGEST

    Maybe you can mention the fact that incorrect field names in yaml fixtures will cause the test to fail with an exception (in the current Rails relase 1.1.4).
    It cost me nearly two hours to trace the exception back to my fixture file because the debug trace does lead to the core Rails libraries

    2006-08-27
    6SUGGEST

    Page 6 mentions that Rails 1.1 is described.

    Question/suggestion: will the CRUD/resource-based features as keynoted during RailsConf and mentioned on http://weblog.rubyonrails.com as to be included in release 1.2 (release “soonish”) also be part of this second edition?

    If not, you can already prepare to write a third edition :-) since that 1.2 release will make a significant enhancement to Rails that will be of great interest to a lot of people.

    BTW, what a great medium, such a beta book! Great job.

    (Dave says: SImplyRestful shoul dmake it into this edition)

    2006-08-20
    66SUGGEST

    There appear to be problems with the default mysql component in Ruby/Rails which result in an error:

    Mysql::Error: Lost connection to MySQL server during query: SHOW TABLES

    when you do the first “rake db:migrate” command. Judging from web searches, a lot of people have this problem but the book doesn’t currently cover it and the existing tests given in the book don’t help. I suggest adding an extra item referencing:

    http://wiki.rubyonrails.com/rails/pages/Mysql+Connection+Problems/

    which describes both the problem and how to fix it.

    2006-08-20
    41TYPO

    The last sentence at the bottom of the page (the footnote), the sentence reads “We discuss rjs on on page ??”, where “on” has been doubled.

    2006-08-20
    95SUGGEST

    The first paragraph reiterates the problem with GET versus POST in a way that looks like the writer doesn’t remember what they wrote about :post => true one page 85 (PDF). This is quite annoying. Consider rewriting the paragraph on page 95, and/or mention button_to in the sidebar on 85.

    2006-08-20
    355SUGGEST

    It would be nice to point out potential race conditions when using “validates_uniqueness_of”

    See http://www.ruby-forum.com/topic/65257

    (Dave says: good point)

    2006-08-23
    97SUGGEST

    In the Playtime section, one of the items is to add a helper method for currency conversion, however we aren’t told how to add helper methods until page 133. At the very least, a reference to the helper method section might be worthwhile.

    2006-08-20
    181OK

    The first sentence reads “… use respond_to() to vector to the correct …” which cannot be right.

    (Dave says: seems OK to me)

    2006-08-05
    137TYPO

    “quatity” instead of “quantity”

    2006-08-22
    226TYPO

    Last sentence in last paragraph begins: “You cn use it…”, it should probably read “You can use it…”

    2006-08-23
    109OK

    Re: "If we were rolling the Depot application into production, we

    2006-08-05
    584TYPO

    last sentence “with deployment your application” - make deployment => deploying

    2006-09-26
    252TYPO

    Last sentence before section 15.4 begins “In a Raails application”, which should probably be “In a Rails application”

    2006-08-23
    132ERROR

    On this (and the next page) you write that when we use display:none for the cart, we don’t get any flicker in the browser when the cart blinds down. this works in firefox but in the ie6 I still get a flicker.
    knoebi [] gmail.com

    (Dave says: I added a note to this effect)

    2006-08-22
    331TYPO

    First word (continued from previous page) - “establish these con-traits - constraints is missing the ”s".

    Cheers.

    2006-08-23
    291OK

    The oracle adapter is listed as taking a
    :database => “railsdb”
    parameter. This should instead be:
    :host => “db.company.com/railsdb”

    (Dave says: according to the source, :host is obsolete)

    2006-08-23
    185TYPO

    "… It installs as a plugin, so you

    2006-08-22
    356TYPO

    In the next second last paragraph, the second sentence contains the word polymorhpic which should surely be polymorphic.

    2006-08-23
    262TYPO

    “two options..” - One too many full stops (or periods).

    2006-08-23
    262TYPO

    “The precision option specifices…” - should perhaps be “specifies”.

    2006-08-23
    178OK

    should the id at the top of this page instead be product.id
    ?

    (Dave says: no—it’s just an id)

    2006-08-27
    184TYPO

    Should be “task”

    "There

    2006-08-22
    103OK

    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 directory app/views/store
    directory. We haven

    2006-08-05
    75SUGGEST

    The last sentence of callout 3, “… put an explicit username in these two fields” needs clarified. While this paragraph refers to the username, the quote “… put an explicit username in these two fields” suggests a second username. I think the author meant to say, “… put an explicit username and password in these two fields” because callout 3 refers to a username and password.

    2006-08-20
    330TYPO

    The code snippet on this page says

    “create_table line_items do |t|” …

    but it should be

    “create_table :line_items do |t|”

    line_items has a missing :

    2006-08-23
    157TYPO

    On the bottom of page, remove one ‘s’ from ‘attr_accesssor’:

    "If it wasn

    2006-08-22
    236OK

    On page 236 of the beta version of the .pdf:

    After successfully installing Subversion v. 1.1.4, when I attempt to run the command:

    svn propset svn:externals \\
    “rails http://dev.rubyonrails.org/svn/rails/trunk” vendor

    (yes, on the same line, without the backslash)
    I get the following response:

    “svn: ‘vendor’ is not a working copy”

    I don’t know what I should replace the ‘vendor’ tag with. Please let me know if there is a simple fix or what the tag that should replace the ‘vendor’ tag should be. Email: s dot d at comcast dot net

    Thanks for the great book and the early look.

    (Dave says: in the previous paragraph, it explains that this only works if you keep your source under subversion too)

    2006-08-20
    349TYPO

    book says:
    a.readings.create(:user => u1, :read_at => Time.now, :rating => 5)
    but u1 variable was never created, perhaps it meant to say :user => u

    2006-08-23
    131OK

    As I’ve completed through iteration D3 and section 9.4, I notice confusing behavior in the code as written. Now that AJAX is used to maintain the sidebar cart, perform the following actions: click empty cart and then add an item to the cart. The “Your cart is currently empty” flash message remains at the top of the page even though the cart is empty.

    (Dave says: this is mentioned and fixed 4 pages later…)

    2006-09-04
    140OK

    The 006_create_line_items migration self.down method should remove the foreign key restraints

    (Dave says: they are dropped when the table is dropped)

    2006-08-22
    487SUGGEST

    It would be helpfull to see a way to add a progress bar during upload (Action Pack Upload Progress?)

    (Dave says: I now reference the upload_progress plugin)

    2006-10-18
    334322SUGGEST

    In par. 2, “Previously, we held the list as a Ruby array and serialized it into the database as a YAML string…” (about aggregated data). However, the example which uses YAML is page 335 (PDF) in “Storing structured data”

    2006-08-23
    236SUGGEST

    It might be useful also to include here a reference to the use of the Mongrel server as this seems to be getting more popular for use with Rails applications.

    (Dave says: this is covered in the Deployment chapter)

    2006-08-27
    250ERROR

    depot> script/console
    Loading development environment.
    >> “goose”.pluralize
    => “gooses”
    failed to work on my system; I had to instead insert the word “ruby” before the word “script”…
    depot> ruby script/console
    Loading development environment.
    >> “goose”.pluralize
    => “gooses”

    2006-08-24
    265SUGGEST

    The "loading data with fixtures seems a little unDRY and maybe even clumsy to me.

    As fas as I’m concerned the easy way to do this is
    YAML.load_file(fixturefilename).each {|key, value| UserData.new(value).save}

    this way you don’t have to repeat any configuration data to instantiate the fixture (and there’s no need to worry about any magic as plainly none is used.

    (Dave says: I’ve included both now)

    2006-08-27
    137TYPO

    Playtime, 4th item, last sentence:

    Get it working without uing Ajax first, then add in the Ajax goodness.

    ‘uing’ is the typo

    2006-08-22
    191SUGGEST

    If we implement the playtime excercise on page 87 (validate_length_of on title), then the product.valid?
    assertion in test_positive_price fails because the title “xxx” is too short.

    Recommend putting a note in the book that code written for the Playtime excercises may cause issues down the road and to either do them as a seperate fork or at least be prepared to modify test cases as needed.

    (Dave says: I made the title longer in the test)

    2006-08-27
    540ERROR

    For an smtp server that doesn’t require login, the config file must have the following settings commented out

    1. :authentication,
    2. :user_name
    3. :password (might not be needed)

    Commenting out only the :authentication line results in a non descriptive error (something not being implemented).
    See line 411 in the lib smtp.rb for details
    (authenticate user, secret, authtype if user)

    2006-10-09
    282ERROR

    depot> script/console
    Loading development environment.
    >> class Order < ActiveRecord::Base
    >> end
    => nil
    This did not work on my system - I had to insert the word ‘ruby’ before ‘script’ for it to work:
    depot> ruby script/console …….etc

    2006-08-23
    185TYPO

    First item, around the end: “rquests” should read “requests”.

    2006-08-22
    194SUGGEST

    I’m just being picky, but saying :products is the symbol name of the model goes against the distinction you made b/w model and table name earlier on. It would be even more blatant with inflections, such as person/people. The symbol name used by the fixtures class method is about the table, not the model.

    2006-08-27
    52TYPO

    the collesponding template that displays the file names in a list on

    2006-08-20
    223TYPO

    “Let’s run the perofmance test.” should read “performance”.

    2006-08-23
    343OK

    In the whole Section 18.2 Specifying Relationships in Models, you don’t have any table or migration examples. Though you do show it a bit in section 10.1, it would be helpful to again show the impact of the belong_to on the table, in particular the need to add the foreign keys and maybe more discussion on creating constraints or otherwise automating any of this.

    (Dave says: I hope the diagrams of tables give the information you want: I really don’t want to make this section longer by adding a bunch more code)

    2006-08-23
    316TYPO

    “The variants differ in the way the report errors.” should be “The variants differ in the way they report errors.”

    2006-08-23
    316TYPO

    “save
    Returns true if the record was saves, nil otherwise.” should be …
    “save
    Returns true if the record was saved, nil otherwise.”

    2006-08-23
    161ERROR

    The flash for add_user is not working 100% properly. After you’ve added a new user you get the flash “User xyz created”. If you then click on the nav bar on the “Products” or “List Users” link the same flash message is still visible.

    The only way I found to fix this is to in the admin.rhtml layout do this:

    <% if flash[:notice] -%>

    <%= flash[:notice] %>

    <% flash[:notice] = nill %>
    <% end %>

    ..to zero out the flash for the next request. I thought Rails was supposed to do this automatically, but in this case it’s not working like it’s supposed to without the above fix.

    (Dave says: I should have used flash.now)

    2006-09-04
    182TYPO

    Last sentence in this page is “we dump out the products variable..." but it should be "we dump out the product variable…”

    2006-08-27
    183ERROR

    Figure 12.3 should be inside section 12.2, i. e. in page 184 or 185 instead of page 183

    2006-08-23
    102OK

    Neither this page nor the Ruby Guide appendix offer an explanation of attr_reader: I had to Google for it.

    (Dave says: it is in the appendix under attr_accessor. I’ve added a link)

    2006-08-20
    354TYPO

    Last line on the page: “… all the subclasses in out inheritance tree.” The word “out” should be “our”…

    2006-08-23
    343TYPO

    In the text box “Yes, It’s Confusing”, 4th line: “This is largely do to the gradual…” Should be “…largely due to…”

    2006-08-23
    347TYPO

    :uniq => true results in an error (Rails 1.1.6)
    ArgumentError: Unknown key(s): uniq

    (Dave says: should be :unique. Sorry)

    2006-08-23
    163OK

    The screenshot of the new Add User form shows the content with styling from depot.css, but I don’t think we’ve yet created a layout for the Login controller that includes that stylesheet. That said, I’m multitasking, so maybe I just missed it.

    (Dave says: The login controller includes the admin layout.)

    2006-08-27
    171OK

    The screenshot of the list users page shows the framing from the Admin layout (the banner and sidebar). However, list users comes from the Login controller, which doesn’t have that framing (yet). Did I miss something?

    (Dave says: page 161, where we talk about adding the admin layout to the login controller)

    2006-08-27
    74OK

    I know that by the time the book is out, :decimal will probably be in released Rails. But right now it isn’t. I do think you should at least note the issue in the text, and provide a :float alternative?

    (Dave says: The book already says this in the introductory materials, and there’s an explicit note in the first Depot chapter)

    2006-08-20
    540SUGGEST

    It would be helpful to point out that a reconfiguration requires a restart of script/server…

    2006-10-12
    38SUGGEST

    It would be very helpful to move the point made in paragraph 2 on page 39 - "… in this test environment we don

    2006-08-20
    1OK

    If the first column of the errata table listed the (first) page number to which each errata is addressed, it would greatly speed up the process of determining whether or not an errata has already been submitted.

    (Dave says: it does, assuming people fill it in…)

    2006-08-20
    87OK

    The last suggestion under “playtime”, viz “Add the product price to the output of the list action”: following the exercise from start to finish and the static scaffold was done after the price was added, so it is already present in the list action.

    (Dave says: but then we rewrote the list.rhtml code…

    2006-08-20
    93ERROR

    I believe the line:

    <%= sprintf(“$%0.02f” , product.price) %>

    should be:

    <%= sprintf(“$%0.02f” , product.price) %>

    2006-08-20
    73OK

    The directions for installing the correct beta release of Rails is not defined well enough for a novice RoR user to figure out. No release is specified in the book to pull from and doing a Google search doesn’t mention which release :decimal has been added as a type to Rails.

    (Dave says: Edge Rails isn’t a particular release—it’s the latest version)

    2006-08-20
    305TYPO

    Last sentence on the page: “all the options added to the basic find( ) method render mean that you can avoid resorting to this low-level method”. Not sure what you mean by “render”, should it be removed?

    2006-08-23
    306SUGGEST

    Fourth paragraph, second sentence: “The with_scope mechanism lets
    you set up a set of default options…”. Using the word “set” twice in four words makes this sentence quite hard to read. I suggest you change it to: “The with_scope mechanism lets you set up some default options…”

    2006-08-23
    90OK

    "we

    2006-08-20
    89TYPO

    I had the same problem as the person who wrote
    “I am a complete RoR newbie, and this page had me stumped. I would go to: http://localhost:3000/store and I kept getting this error: no route found to match ”/store" with {:method=>:get}. "
    but I solved the problem by using Ctrl+C to close WEBrick and then started it again.
    I think you should mention this might happen?

    (Dave says: I’ve never seen this happen myself, but I’ve added a note)

    2006-08-20
    181TYPO

    For both the curl tests the request header has to be given in double quotes.
    (-H “Accept: application/xml” instead of -H ‘Accept: application/xml’).

    (Dave says: you must be a Windows user… sorry)

    2006-08-27
    482SUGGEST

    When a form using date_select is submitted the action receives params with funny suffixes like (1i), (2i) etc. There is implied magic to turn these params into a date that can be stored in the database. However looking through the Rails list people seem to manually combine these params to make a date. Could you describe what we are supposed to do with these strangely named params? Thanks.

    (Dave says: these are handled automatically by date columns)

    2006-10-12
    83OK

    In your product description you use

    Later, you truncate the description to 80 chars for display.

    Since we’re going through the trouble to seperate the data/logic/display, why are we including markup language in the description?

    etc..

    If the description is longer than 80 chars, we may end up leaving an open

    tag, or require the view to contain logic to shim

    if the description was trimmed.

    IMHO it’s better to not store any markup in the description (other than maybe textilize). If we later make an RSS feed out of new products, this

    will be out of place.

    (Dave says: all good points, but outside the scope of the exercise for now)

    2006-08-20
    484OK

    It might be a good idea to explicitly point out that the option :minute_step is not available when using datetime_select. This is already implicitly stated, but I believe that it is worth emphasizing.

    2006-10-04
    200ERROR

    You write: “assert_not_raise(Exception, …,message) { block… }”
    This needs to be: “assert_nothing_raised( exceptions ) { block }”.
    See also “assert_raise” [sic] vs “assert_raises” on page 199.

    (Dave says:good catch on the ‘not_raised’. However assert_raises is deprecated)

    2006-08-27
    153OK

    In the text

    "And Rails makes it easy for developers to integrate things such as Ajax and RESTful interfaces into their code: support is built in. (And if you

    2006-08-20
    16SUGGEST

    Very end of page 16, continuing onto 17:
    “If a web form contains data related to a business object, Active Record can extract it into our model.”

    This may be nitpicking but it tripped me up until I decided “web form” means “submitted web form”. When thinking of a web form, I first thought of a blank form as presented to a user - the V in MVC - and wondered why Active Record would want to extract it.

    2006-08-20
    100TYPO

    A word was typed twice (side by side). See the “to” in the second sentence below:

    "Rails makes it easy to store session data in the database. We

    2006-08-20
    237TYPO

    Just before the config snippet at page bottom, the closing parenthesis is missing at the end of the last paragraph.

    2006-08-23
    106ERROR

    Reloadable is deprecated in Rails 1.2+

    (Dave says: Yeah—they did that about 2 weeks after this went out. I’ll rework this section once I’m convinced that this change is permanent)

    2006-09-04
    17TYPO

    … That’s why we devote two chapters to it…

    I counted three chapters on ActiveRecord.

    2006-08-20
    331TYPO

    Twice in the code example: “t.column, …” where the comma is a syntax exrror.

    2006-08-23
    314TYPO

    "The :from option let

    2006-08-23
    87TYPO

    Missing close-bracket:
    “The method validates_length_of (described on page 377 checks the length of a model attribute.”
    should be
    “The method validates_length_of (described on page 377) checks the length of a model attribute.”

    2006-08-20
    347TYPO

    “Behind the scenes, Ruby constructs the necessary SQL…” It’s not Ruby but Rails which does this.

    2006-08-23
    172ERROR

    The delete_user action attempts to handle invalid user ids with the line:

    if id && user = User.find(id)

    but User.find doesn’t return nil if the id is invalid, it throws an exception. The code therefore works as intended for a null id, but the second check has no effect.

    (Dave says: actually, it wasn’t really meant to be checked as part of the condition: it was just a way of calling it only if the id was present. That’s kinda ugly through, so I’ve removed it)

    2006-08-27
    358TYPO

    “Now we can retrieve all three assets by interating over the catalog” should read “Now we can retrieve all three assets by iterating over the catalog”.

    2006-08-23
    362TYPO

    Last paragraph: "There

    2006-08-23
    376TYPO

    In the line “validates format of :length, :with /^\\d+(in|cm)$/” the syntax highlighting seems to have gone awry.

    (Dave says: yup—we don’t do a full ruby parse, and it sometimes messes up)

    2006-08-23
    159ERROR

    The validation code for your user model will not work, because you are validating virtual attributes that will not be present on future saves. This also fails for fixtures and other such uses where you do not have the virtual “password” and “password_confirmation” fields. I would suggest taking out those validations, and instead adding a validate method, that does something like,

    errors.add(:password, “must be at least 5 characters” ) if (not password.nil? and password.length < 5)

    (Davs says: good catch)

    2006-10-17
    308TYPO

    “You can set more that just conditions with with_scope.”

    should be “You can set more THAN just…”

    2006-08-23
    316ERROR

    RecordNotSaved instead of RecordInvalid exception ??? (2nd from the bottom)

    2006-08-23
    392ERROR

    scale => 23 (shouldn’t be 2 ?) file: http://media.pragprog.com/titles/rails2/code/e1/ar/transactions.rb also has 23

    2006-08-23
    362OK

    The acts_as_list example uses ‘parent_id’, but doesn’t make it clear that any foreign key/belongs_to could be used for the scope option. This might confuse the reader when he reads the acts_as_tree section (where parent_id is the default) or consult the acts_as_list API documentation.

    (Dave says: I think its faitly clear as it stands—what more could I say?)

    2006-08-27
    366SUGGEST

    It would be nice to know what happens to has_many, too

    2006-08-27
    83OK

    Some of the text inside the paragraph tag is italicised because of the single quotes.

    (Dave says: yes— we don’t do a full parse when highlighting code)

    2006-08-22
    245DEFER

    I would like to encourage you to expand the debugging section significantly. I find that for every minute coding I first spend 10 minutes figuring out what that 1-liner ought to be and then 10 minutes afterwards figuring out why that line didn’t quite work :-).

    You mention breakpoints. I would have found it extremely helpful to have some suggestions about what to do in a break point. (I find the breakpoints verylacking in features because I expected to be in a debugger and not just in a print-values command line, but fixing that is beyond the scope of your book.) For example, I often wonder more about what a specific variable refers to than what the values are. So tips explaining when and how to use: var.inspect, var.methods, var.methods.sort, var.instance_variables.sort, var.method(‘some_method’), etc…

    One thing I never figured out is: if there is a method foo how to determine where foo is defined (or which of several foo is actually being invoked). It would be great if there was a call such as object.method(‘foo’).definition that returned the file and line number at which foo was defined. Unfortunately there isn’t as far as I can tell.

    Another useful tip would be how to run webrick in the debugger and how to set breakpoints. I’ve had mixed success with actually getting breakpoints to “take”. Mostly I can’t figure out what filename to type (absolute vs. relative paths).

    Anyway, all this to encourage you to spend more effort on the debugging section in a great book!!! (I use it all the time as reference.)
    Thorsten tve at voneicken dot com

    2006-08-27
    111SUGGEST

    In talking about the flash, you say " Remem-
    ber that a redirect is sent by our application to the browser, which then
    sends a new request back to our application."

    Now I’ve followed this tutorial from start to here and I’m pretty sure you haven’t introduced a redirect. Unless its automagic somewhere? But I suspect something has moved along the way.

    2006-08-22
    124SUGGEST

    the syntax of the code changes to redirect_to_index are incredibly terse and cryptic, and there is no explanation. How does this syntax accomplish the stated goal?

    2006-08-22
    87TYPO

    First bullet under “Playtime”: Second sentence reads “Add validate to the product model…” This should read “Add validation to the product model…”

    2006-08-22
    269TYPO

    Toward the end of 16.3, regarding the :authors_books join table:
    “In this case, you might want to investigate creating one or more indices on this table to speed navigation between books and authors. Note that these indices cannot have the unique attribute.”
    - Surely a composite index of author_id and book_id can be declared unique?

    2006-08-23
    102SUGGEST

    You introduce the use the concept of params at the bottom of this page for the first time in this book. But the explanation for it is too brief considering that it is the reader’s first encounter.

    2006-08-27
    277OK

    "You

    2006-08-27
    311TYPO

    7th word in 3rd paragraph under counting should be “parameters”

    2006-08-27
    34OK

    On the last line of the listing of the WEBrick server starting, the octothorpe (#) and everything after it suddenly switches to a green font color (I presume it to be misinterpreted as a ruby comment).

    (Dave says: indeed it is, and we can’t fix that without writign full parsers…)

    2006-08-27
    39SUGGEST

    You ask the user to point their browser to ‘http://localhost:3000/say/hello’, but on page 35 you suggest shutting down the WEBrick server via CTRL-C. It might be good to include a brief mention that the server should be restarted if necessary.

    (Dave says: actually, I just that that to shut down an application, you can type ^C. I’m not actually askign you to shut it down on page 35. However, I can see the ambiguity…)

    2006-08-27
    158SUGGEST

    There are two confusing issues on this page.

    First, the password=(pwd) writer uses the “self” keyword a few times without any explanation why. As a Ruby newbie, this sent me off searching for answers. The best I can figure is it’s a meaningless change of style. (“create_new_salt” on page 157 also uses “self”.)

    (Dave says: actually, it’s critical to use self., and I’ve added a paragraph saying why)

    Second, the user.authenticate() method uses the variable name “expected_password” where “entered_password” might be more appropriate. As I read the code, the hashed_password instance variable really contains what is expected. I haven’t read the 1st edition, and suspect “expected_password” comes from legacy code. It’s a minor point, but caused me to stop re-read the code, and broke the flow.

    (Dave says: I’d read “enetered_password” to be the password the user entered…)

    Notwithstanding the above, this is one of the best programming books I’ve ever read. It presents some fairly complex material and yet is very easy
    reading. Excellent work.

    (Dave says: thank you)

    2006-08-27
    15OK

    Code example reads:
    puts “Order #{order.customer_id}, amount=#{order.amount}”

    Are you intending to list the customer_id with an Order # label, or do you mean:
    puts “Order #{order.id}, amount=#{order.amount}”

    (I meant customer_id—we already know the order id :)

    2006-08-27
    223ERROR

    At the bottom of the page the first line of code reads: ‘depot> ruby test/performance/store_controller_test.rb’. However, on the previous page the test file is clearly called ‘test/performance/order_speed_test.rb’

    2006-08-27
    225DEFER

    Section 13.6 (Using Mock Objects) takes a departure from the follow-along method used hitherto in the Depot example. It would be nice if the text allowed the reader to continue following along.

    2006-08-27
    486OK

    The controller calls Picture.new(arg) but the Picture class doesn’t have an initialize(arg) method. There is an accessor picture=(arg) but that doesn’t replace a constructor as far as I know (I’m not an expert at Ruby yet).

    (Dave says: it’s an Active Record object….)

    2006-10-04
    127OK

    The download file for add_to_cart.rjs is an HTML file with html tags in it. Also, the name of the downloaded file ends in “.rjs.html”. Bottom line: you cannot just save the file and use it like the other source files.

    (Dave says: on my browser, if downlaods to “add_to_cart.rjs”)

    2006-08-27
    277TYPO

    in the first paragraph:
    “and the drop( ) method removes them.”
    should read:
    “and the down( ) method removes them.”

    2006-08-27
    254OK

    What’s the difference between ‘now.midnight’ and ‘now.at_midnight’? They appear to do the exact same thing.

    (Dave says: They are both aliases for #beginning_of_day..)

    2006-08-28
    372SUGGEST

    I’m missing a description of what really happens when a validation fails. The text doesn’t even state whether the save/update is not performed, maybe that’s obvious? Say I have a validates_uniqueness_of(:name) on an onject and I change the name and the validator fails, do I now have an invalid object in memory that has not been saved? Is there a way to revert this object to its previous state?

    Also, you discuss how things happen with respect to user interface. How do I handle validations programatically? For example, I added Foo.create(…) calls in a migration to add objects within the migration. It turned out one of the validations failed for some of those objects but I didn’t see any error anywhere. How should I have checked and displayed the error?

    2006-09-04
    203191TYPO

    Listing of Assertions functions degrades into sgml instead of formatted text. I’m getting stuff like this :

    assert_redirected_to(options,
    message)
    <

    Asserts that the redirection options passed in match those
    of the redirect called in the last action. You can also
    pass a simple string, which is compared to the URL
    generated by the redirection.

    Examples:


    assert_redirected_to :controller => ‘login’
    assert_redirected_to :controller => ‘login’, :action => ‘index’
    assert_redirected_to “http://my.host/index.html”

    assert_template(expected, message)<idxmethod method="assert_templ

    Asserts that the request was rendered with the specified
    template file.

    Examples:


    assert_template ‘store/index’

    2006-08-28
    379TYPO

    Minor typo in footnote. THe should be The - lowercase h.

    2006-09-04
    580ERROR

    the first link: http://www.glue.umd.edu/~billtj/ruby.html
    does not work.

    2006-09-26
    336OK

    For acts_as_tree you mention: ’Normally you

    2006-09-03
    395TYPO

    In the paragraph following the code snippet for restful2/config/routes.rb, the first sentence, you have, “… and conditionally created a set up subroutines …”. The word “up” should be “of”.

    2006-09-04
    378ERROR

    I could be wrong, or maybe the behavior has changed, but I believe the @params[:id] entry at the top of the page (and described in the paragraph following) should be a string rather than a number.

    2006-09-04
    378TYPO

    Third paragraph under

    2006-09-04
    380ERROR

    In the second-to-last line at the bottom, the code example is missing a colon in front of the symbol

    2006-09-04
    379ERROR

    The url misses the starting /

    >> rs.recognize_path “coupon/show/1”
    ActionController::RoutingError: no route found to match
    “coupon/show/1” with {}

    should be this

    >> rs.recognize_path “/coupon/show/1”
    ActionController::RoutingError: no route found to match
    “/coupon/show/1” with {}

    2006-09-04
    388TYPO

    s/contraining/constraining/

    2006-09-04
    215OK

    "…web server, using LigHTTP (if it

    2006-09-04
    145TYPO

    From page 145:

    "There

    2006-09-04
    159OK

    Method safe_delete is missing in Download depot_q/app/models/user.rb

    (Dave says: I see it when I download)

    2006-09-04
    407TYPO

    with id 4 for the article with an id of 99, you’d use a path of /article/99/comment/3.

    should it be?

    with id 4 for the article with an id of 99, you’d use a path of /article/99/comment/4.

    2006-09-26
    377TYPO

    In the 2nd paragraph of the description of the :conditions parameter for map.connect, it reads: “… when it receives a POST request to /store/checkout, but…” Should probably be GET request in order to match up with the code example right below the paragraph.

    2006-09-04
    37TYPO

    “accounts for the blank line bewteen the” should be “between”.

    2006-09-04
    395TYPO

    For example, we may `way` to allow folks to comment on our articles.

    perhaps `want` instead of `way`?

    2006-09-04
    315TYPO

    Last line on the page:

    …between the child and partent

    2006-09-04
    108OK

    The function total_price does not calculate the price correctly. It does not take the quantities of the items into consideration.
    Code from the book:
    def total_price
    @items.inject(0) { |sum, item| sum + item.price }
    end

    Code I would suggest
    def total_price
    @items.inject(0){|sum, item| sum+(item.price*item.quantity)}
    end

    (Dave says: the code is correct as it stands: have a look at CartItem.price)

    2006-09-03
    79OK

    the first migration in this chapter works fine, however when you attempt the migration on page 79 to add a new column you get the following error:

    AddPrice: migrating ==
    — add_column(:products, :price, :decimal, {:precision=>8, :scale=>2, :default=>0})
    rake aborted!
    You have a nil object when you didn’t expect it!
    You might have expected an instance of Array.
    The error occured while evaluating nil.[]

    Copying the source code from the support site also produces the same error. Source code listed here:
    http://media.pragprog.com/titles/rails2/code/depot_a/db/migrate/002_add_price.rb

    (Dave says: YOU MUST USE EDGE RAILS WHEN READING THIS BOOK)

    2006-09-03
    215SUGGEST

    Hi There,

    Great book - really enjoying it. One thing I have come accross as I work my way through the section on testing is that some of the tests are incorrect if I make the changes suggested at the end of the earlier chapters. For example one of the chapters suggests altering 2 controller functions and merging them into one - which I did, but then the test does not work. Not a big issue just something you may want to make other readers aware of.

    Cheers,

    Dhugal.

    2006-09-04
    391TYPO

    Footnote (7): “…there may well be support build into Rails to create…” should be “built into Rails”, not “build”.

    2006-09-04
    388TYPO

    we

    2006-09-04
    375SUGGEST

    You mention generating URLs here (the generate method, as well as url_for and link_to). I think it would be better to leave those until p380 or later, after you’ve introduced the other side of routes and explained how generation works and what it’s used for.

    2006-09-04
    289TYPO

    count is probably spelled incorrectly as ‘counf’

    2006-09-04
    19SUGGEST

    A footnote for the Windows install should mention that InstantRails uses MySQL 4, not 5. InstantRails2 will use 5 when it’s released. 4 contains bugs that may or may not affect the developer.

    (Dave says: mentioned)

    A URL to a Cygwin installation would also be nice. A Cygwin install does offer advantages over InstantRails, for example, tailing the log, not to mention a solid compiling environment, plus many others. Granted it’s no one-click install, it will change OS settings, and it has a few speedbumps (rebaseall comes to mind).

    (Dave says: that’s a can of worms I really don’t want to open. If you’re up to running Cygwin, then I figure you’re up to installing it :)

    2006-09-04
    325TYPO

    Class-name “manager” in the graph should be capitalized

    2006-09-04
    118OK

    If possible, provide a link to a video illustrating the animation for those readers who are not building the app as they read. This applies for all AJAX (and other animated) examples. Not a priority, but nice to have.

    Another option would be to host each iteration of the application. http://depot.pragprog.com/a1/ thru f4/ and final/

    (Dave says: you can always download each iteration as part of the zip or tarballs)

    2006-09-03
    383TYPO

    s/url_form/url_for/

    2006-09-04
    66OK

    A link is given to page 217 on how to install Edge Rails. But this page does not mention how to install Edge Rails. For edge Rails, first you need to install Subversion if you have not already. Download and install it form here:
    http://subversion.tigris.org/project_packages.html
    and then install Edge Rails using the newly installed svn command:
    svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails

    (Dave says: my page 217 says you have to install svn, and talks about installing edge rails)

    2006-09-03
    6TYPO

    “This book documents Rails V1.2, which will became available…” - “became” should be “become”.

    2006-09-04
    27OK

    In the list of database drivers, consider referencing IBM’s driver and Rails adapter for DB2. They provide a “starter kit” for Windows here:
    http://tinyurl.com/o9npt
    and if you look at the downloads tab they provide source for the DB driver and Rails adapter as a separate download.

    (Dave says: I believe I already reference them)

    2006-09-03
    65TYPO

    "That

    2006-09-04
    230SUGGEST

    Even though

    groups = posts.group_by {|post| post.author_id}

    is valid, isn’t the Rails way more like

    groups = posts.group_by {|post| post.author}

    assuming the has_many/belongs_to relationships are defined.

    2006-09-04
    471SUGGEST

    The picture field really confused me because it has the same name as the object that owns it. I suggest using a different name for it, like ‘file’.
    I also don’t see the reason for creating the @picture attribute in the controller get method.

    (Dave says. Renamed. The @picture is needed to supply an object to the form)

    2006-10-04
    324OK

    The Person et al. models may be inappropriate for the section especially with the poorly defined foreign key, reports_to. It’s not often you see an id for an association being manually set. Perhaps Shape, Circle < Shape, Polygon < Shape, Triangle < Polygon may be a better example. The Person models may be better served as an example of STI combined with self-referential joins which could follow section 18.5. Other (sub)sections could be STI combined with acts_as_xxx eg. STI + acts_as_tree, Node, InternalNode < Node, LeafNode < Node.

    (Dave says: a triangle is not a subclass of a polygon, as it fails Liskov Substitution)

    2006-09-04
    374SUGGEST

    “puts rs.routes.map(&:to_s)” produces the same results as the simpler “puts rs.routes.map”.

    2006-09-04
    339TYPO

    “The rules for when things get saved when collections are involved (tht is,”

    should be “that” not “tht”

    2006-09-04
    375TYPO

    THe only reason we

    2006-09-04
    399TYPO

    We

    2006-09-04
    405TYPO

    This is sometimes
    used when responding o an Ajax request.

    to

    2006-09-04
    406TYPO

    (becase render is called twice)

    because

    2006-09-04
    239SUGGEST

    It would be VERY helpful if somewhere in here the use of rake to revert to a previous database version was mentioned — the reader is told that it is possible, but not HOW to do it.

    (Dave says: it’s two pages on, but I’ll make it more explicit)

    2006-09-04
    331ERROR

    Looks like :blob types are now :binary, or so says ActiveRecord::ConnectionAdapters::TableDefinition.column in my API docs.

    2006-09-04
    219OK

    Edge Rails renders the server inoperable. This is the third time I’ve updated to Edge and the server still exits with an error every time:

    opening pid-file failed: /Users/’user’/work/depot/tmp/pids/lighttpd.pid No such file or directory

    (Dave says: did you run rake rails:update?)

    2006-09-05
    381ERROR

    In the paragraph starting “In the following example,…”, I think ‘receives a POST request’ should be replaced with ‘receives a GET request’

    2006-09-11
    383TYPO

    Paragraph near bottom of page, right about ‘URL Generation’ section:
    ‘creaing’ should be changed to ‘creating’

    2006-09-11
    81OK

    http://media.pragprog.com/titles/rails2/code/depot_c/db/migrate/003_add_test_data.rb

    The sample prices are given as floats, and there is a validation to only accept integer values!

    (Dave says: please get the latest version of the PDF)

    2006-09-05
    236TYPO

    How to form the plural of a word or class or words given the singular
    form.

    Should be:

    How to form the plural of a word or class of words given the singular
    form.

    2006-09-11
    120OK

    under rails 1.1.16 in D4 doing the highlight and blind_down effects…

    the book’s code only exposes the cart if the page is refreshed, and then without the blind_down effect, but…

    using…
    page.visual_effect(:blind_down, “cart”) if cart.total_items == 1 instead of the book's page[:cart].visual_effect :blind_down if cart.total_items == 1
    gets the blind_down effect working correctly so it exposes the cart, gradually

    it’s similar to the way as 4267 in the errata until 1.08 needed to use
    page.visual_effect(:highlight, “current_item”, :startcolor => “\\”#88ff88\\“”, :endcolor => “\\”#114411\\“”)
    to get the highlighting effect to work with rails 1.1.4
    instead of the book’s…
    page[:current_item].visual_effect :highlight, :startcolor => “#88ff88”, :endcolor => “#114411”

    for some reason the 4267 has been removed from the errata, but the issue for highlight and blind_down effects still exists in the book’s code as of B1.10 which was just downloaded to check

    the code at

    http://media.pragprog.com/titles/rails2/code/depot_m/app/views/store/add_to_cart.rjs

    and

    http://media.pragprog.com/titles/rails2/code/depot_n/app/views/store/add_to_cart.rjs

    also appears to still have this issue of still using
    page[:cart].visual_effect …
    and not
    page.visual_effect(:, “cart”) …

    thanks!

    (Dave says: the core team swear that both should work (and, to be fair, both work for me here). However, I also hear reports like this. I’m going to keep pushing the cor team on this.

    Dave says: I’ve now tried this on every browser I have, and under Windows and OSX, and it seems to work as it stands. I’m going to take a risk and leave the code as it)

    2006-10-17
    218OK

    Why do you keep deleting my report of a problem with the Edge Rails instructions? It is very frustrating to be stuck with an unusable app so early in the progress of following this book.

    After updating to Edge Rails (5018) the server exits with an error.

    (Dave says: I don’t believe this is a problem in the book. It says that your project has to be under subversion for the instructions to work. The error you’re seeing indicates that your project isn’t. Please e-mail me privately if I’m misunderstanding and we’ll get it resolved. dave at pragprog.com)

    2006-09-06
    240TYPO

    it is —skip_migration rather than —skip_migrations

    2006-09-11
    386TYPO

    Missing “we”

    We’ve already seen how could link to the list users action with a named URL
    generator.

    2006-09-11
    387TYPO

    Case typo: “URL by URl” -> “URL by URL”

    2006-09-11
    125TYPO

    http://media.pragprog.com/titles/rails2/code/depot_l/app/views/layouts/store.rhtml
    contains

    <%= javascript_include_tag :defaults %>

    which prevents the inclusion of the javascripts necessary!

    2006-09-11
    106SUGGEST

    Could you add some additional context / description about the inject method / fix the link to the inject reference?

    (Dave says: changed to use sum)

    2006-09-11
    76OK

    In the layouts file, <%= yield %> is used over <%= @content_for_layout %>

    Resource: http://weblog.rubyonrails.org/2006/4/25/use-params-not-params

    (Dave says: the statement there is oncorrect: yield is not deprecated)

    2006-09-11
    351OK

    It seems like the single inheritance column “type” is depracated in favor of “class”

    (Dave says: I see no evidence of this: could you point me somewhere?)

    2006-09-11
    25OK

    Suggested editors:
    Perhaps you should at least mention Vim.
    Vim has very good Ruby support (Zed Shaw for one seems to rely on it a lot (http://mongrel.rubyforge.org/security.html) and Rails support appears not to be too bad, either (http://wiki.rubyonrails.org/rails/pages/HowtoUseVimWithRails).

    Vim may not be as good as Emacs, but is quite popular, and works well on Windows (on Linux Vim is the default editor).

    (Dave says: I don’t really recommend Emacs, so I don’t feel I need to recommend vim. I’m sure eitehr is fine)

    2006-09-11
    570TYPO

    Service-Oreinted Architecture:
    should be Service-Oriented Architecture

    2006-09-26
    22SUGGEST

    The link http://wiki.rubyonrails.com/rails/pages/RailsOnUbuntuDebianTestingAndUnstable is rather outdated and gives instructions valid mainly for the version of Ubuntu that came almost a year ago (Breezy). Dapper is now the newest version, and it’s also a LTS (long time support) release which means that it’s more polished/stable than most versions and is supported (and will get security updates) until 2009. Therefore it’s a very appropriate version to use for servers.

    Here are more up to date instructions even including info about the soon to be released more bleeding edge-like version Edgy. http://wiki.rubyonrails.org/rails/pages/RailsOnUbuntu
    (Haven’t tried them yet, but they seem to be replacing the old guide. So they’re kind of THE official instructions for Ubuntu.)

    2006-09-11
    313TYPO

    In “One-to-One Relationships”: “..by adding a has_one declartion…”

    declartion —> declaration.

    2006-09-11
    25TYPO

    …best open source developer tool based on eclipse. Should be Eclipse in all cases.

    2006-09-11
    460SUGGEST

    The current pagination in Rails has usability and scalability shortcomings. There seems to be a move to deprecate it for Rails 2. See http://glu.ttono.us/articles/2006/08/30/on-the-days-events

    2006-10-04
    268SUGGEST

    "Note that we

    2006-09-11
    571TYPO

    27.4 Repetable Deployments with Capistrano

    Should be Repeatable, obviously.

    2006-09-26
    69TYPO

    In this page you are (or will) using BigDecimal from rails edge, but in the footer, you say: "so you

    2006-09-11
    69SUGGEST

    I have problems to find information about the order in that validation occurs in a model, maybe you could add a paragraph in the text about it.
    For example, what is executed first
    validates_* or
    def validate
    end

    And in the example from book, you validated price for numericality and implicitly for presence, but you didn’t added it to validates_presence_of, but you created a validate method.
    In the validate method, you check for nil, that is the way to check for presence and then the validation specific to the field.
    Maybe you could explain a little more the validation, for example, what would happen if I put
    validate_presence_of :field

    and then
    def validate
    (use of field to some kind of validation)
    end

    If the validate_presence_of :field is unnecesary and should be handled in def validate, I think that it should be noted in the text.

    (Dave says: validation is covered in depth in the Active Record chapters)

    2006-09-11
    623ERROR

    Should be font-family, not font-style:

    .depot-form legend {
    color: #dfd ;
    background: #141 ;
    font-style: sans-serif;
    padding: 0.2em 1em;
    }

    2006-10-05
    382TYPO

    Example at bottom of page

    >> rs.recognize_path “coupon/show/1” won’t work whether or not ‘coupon’ is a known controller since the leading’/’ is missing. sb >> rs.recognize_path “/coupon/show/1”

    2006-09-11
    260TYPO

    Reader Claus Dahl observed that You

    2006-09-11
    477SUGGEST

    In the section “Selection Lists”, there is room for improvement for distinguishing between options and choices. at present, it is difficult to determine how the two items are used.

    it’s a great book and i am enjoying learning rails with it. keep up the good work!

    2006-10-12
    569TYPO

    4th para, 3rd line should be “had”, not “hand”
    "FastCGI also comes with numerous options for deployment. However, FastCGI
    came with lots of issues. FastCGI dates back to the mid-1990

    2006-09-26
    400TYPO

    Para #1, Sentence #2: ‘However’ is misspelled

    2006-09-11
    236TYPO

    David says:
    "But they don

    2006-09-11
    25SUGGEST

    Well, I’d mention the magic configuration options in the RadRails, Instant Rails combination, simply because it so used. Really, this section wants to grow into either an appendix or reference to an online page.

    (Dave says: give me a reference and I’ll include it)

    2006-09-11
    55SUGGEST

    A good place for a footnote about paths. If you used InstantRails and thought everything was just set up, you still need to find the MySql bin directory. Nothing does everything.

    (Dave says: hopefully this will be talked about in the resource whose link you’ll give me. )

    2006-09-11
    242TYPO

    The index_by( ) method
    takes a collection and converts IT (!!!!!) into a hash where the values are the values
    from the original collection.

    2006-09-22
    28SUGGEST

    The method for installing the ADO driver is unnecessary. You don’t need to manually create folders and copy files. Just unzip the ruby-dbi package, navigate to the directory where you unzipped it, and run the following three commands:

    ruby setup.rb config —with=dbd_ado
    ruby setup.rb setup
    ruby setup.rb install

    2006-09-22
    76SUGGEST

    You ought to change the content_for_layout to the yield and maybe explain why so people know why they see the original way sometimes and why yield is there now.

    (Dave says: nope: I much prefer content_for_layout. It is not deprecated, despite rumors to the contrary)

    2006-09-19
    92SUGGEST

    The floats in the css for displaying the catalog entries causes problems if the description doesn’t take up more vertical space than the product image. Each subsequent entry ends up to the right of the image associated with the preceding entry. (Try out some one-word descriptions if this doesn’t make sense).
    Adding
    clear: both;
    to the css for “#store .entry {” fixes this.

    2006-09-22
    66OK

    Installing Edge Rails only because a Decimal is used and not a float? Even for a beta of the book? Recognize that this step takes longer than the entire time I have spent on the book so far. First, I download svn. I’ll need to figure out repositories and things and installation, which appears non-trivial from the documentation. Then I’ll figure out EdgeRails. Compare this to the earlier step of “download and run InstantRails”. Consider better instructions, or a work around. Any idea when Rails 2.0 will ship?

    (Dave says: welcome to life on the Edge! The beta book documents the upcoming version of Rails—right now the only way to get these features is via Edge)

    2006-09-19
    38TYPO

    “In general, supressing these newlines is”

    2006-09-22
    326SUGGEST

    Footnote reads:
    "Unless you specify that your database should enforce foreign key contraints. Polymorphic associations
    won

    2006-09-22
    93OK

    cart.rb needs to have “include Reloadable” in order for it to be automatically reloaded each time the server is queried (default behavior in development mode). But because the example cart model is not a subclass of ActiveRecord::Base this reload does not happen

    I ran into this problem trying to add total_price on page 106.

    (Dave says: update to the latest Rails: Reloadable is now deprecated)

    2006-09-19
    126SUGGEST

    In the fourth bullet of “Playtime”, in order to create a link that decrements the quantity of the item, and in order for it to work with or without ajax, I had to read the api documentation for link_to_remote to figure out how to populate the HREF portion of the link (so it also works without javascript.)

    However, I could not figure out how to get this to follow the guideline offered on p. 447 (section 26.1 — “The problem with GET requests”, i.e., only put desctructive actions behind a POST request.) Is it possible to create a desctructive link (not button) that (1) degrades well to non-ajax and (2) following the POST guideline? If there is no possible way, should you footnote this bullet item, referencing section 26.1?

    This appears to be a limitation that comes with using links and not buttons, as you point out in section 26.1. Maybe it should be noted here. Thanks.

    (Dave says: I’m glad the exercise made you think. These are just the kinds of issues faced in real applications.)

    2006-09-22
    379TYPO

    2nd paragraph, last sentence. “Chapter 21, Action Controller and Rails they looks at how you write
    code in a controller.” ‘they’ should be ‘then’.

    2006-09-22
    30(42)TYPO

    last paragraph, line 5 says:
    “youcan press”
    it should be:
    "you can press

    2006-09-22
    231TYPO

    In the footnote, want is mispelled.

    2006-09-22
    190TYPO

    get …. :ruby_book
    get …. :ruby__book

    2006-09-22
    384TYPO

    2nd paragraph under :conditions. The first occurence of the word POST should be GET.

    2006-09-22
    391TYPO

    In the description for skip_relative_url_root the word “to” is duplicated - “to to”.

    2006-09-22
    393TYPO

    The word “parameters” is misspelled in the paragraph that starts “Finally, if the only paramaters to a named URL”.

    2006-09-22
    394TYPO

    In paragraph just under the Resource-based Routing header, there’s a capitalization error “URL by URl”.

    2006-09-22
    394TYPO

    In paragraph just under the Resource-based Routing header, last sentence, the word “understand” is misspelled as “undestand”.

    2006-09-22
    395TYPO

    Last sentence of 1st paragraph, there’s a misspelling: “contraining”.

    2006-09-22
    66SUGGEST

    Please suggest an edge version of Rails that you’ve confirmed as working with the examples provided in the book. Ie. I tried “rake rails:freeze:edge REVISION=4567” as shown in an example at page 225, this version couldn’t handle the next step on page 67.

    As a newbie to Rails this can be very confusing, but I tried with the newest edge (5125 at the time of writing) which worked, but if that one hadn’t worked I’d probably incorrectly assumed that I had some error somewhere else.

    (Dave says: 4567 was just an example of a revision. I’ve changed it to make this clearer)

    2006-09-22
    167TYPO

    The last line begins with a parenthesis, but there doesn’t appear to be a closing one.

    2006-09-22
    75TYPO

    The URL in footnote 10. has a dot (.) after the URL, which probably shouldn’t be there.

    2006-09-22
    580SUGGEST

    the broken first link content appears to be here:

    http://books.rubyveil.com/books/ThingsNewcomersShouldKnow/Introduction/ThingsNewcomersShouldKnow

    (Dave says: thanks!)

    2006-09-26
    84ERROR

    Please begin all your layout templates with a proper DOCTYPE declaration on the first row, otherwise IE6 will go into quirks mode instead of ‘standards compliant’ mode. Which means that it implements stuff according to some old IE5 CSS bugs instead of according to the standards.

    2006-09-22
    88TYPO

    “…the Rails helper image_tag constructs an HTML tag.” I assume you mean “an HTML tag.”

    2006-09-22
    407TYPO

    Note: the indicated page number is the number ON the page, not the Adobe reader page number.

    Second full paragraph, “but setting” s/b “by setting”, I think.

    Either way I think it would be nice if you actually named the variable.

    2006-09-26
    133OK

    Your book says to implement total_items this way:
    def total_items
    @items.sum { |item| item.quantity }
    end

    When i tried to run this my cart would no longer be updated. I checked the development.log and it said:
    ActionView::TemplateError (undefined method `sum’ for #) on line #3 of app/views/store/add_to_cart.rjs:

    I changed that line to
    def total_items
    @items.inject(0) {|sum, item| sum + item.quantity}
    end

    to fix this problem.

    (Dave says: update to Edge Rails for this top work)

    2006-09-19
    202OK

    It should be noted that if you’ve done Playtime (1st bullet) at the end of Task G, assert_template(“index”) will fail with the following message:

    expecting <“index”> but rendering with <“index.rhtml”>

    To fix, you can either remove the respond_to block in StoreController::index, or modify assert_template() to simply look for “index.rhtml” instead.

    (Dave says: Already noted on page 172)

    2006-09-22
    408TYPO

    Under assert_routing the code snippet is incorrect; it’s the same as assert_recognizes.

    2006-09-26
    220TYPO

    Most experienced Rails developers wil create subdirectories to group
    related functionality under lib.

    “wil” should be “will”

    2006-09-22
    238TYPO

    “or class or words” -> “or class of words”

    2006-09-22
    196ERROR

    Attributes selectors syntax examples have a couple errors. Some are missing the closing bracket ]. The ones that show pattern matching have the = and the other character flipped, e.g., =* should be *=

    2006-09-22
    389SUGGEST

    Is the rule that’s being applied the below the Rails admin stuff rule? If so, I think it is the 4th rule in routes_for_blog.rb.

    Text:
    >> rs.generate({:action => “edit” , :id => 123}, last_request)
    => “/blog/blog/edit/123”
    Here the first blog is the fixed text, the second blog is the name of the controller,
    and edit is the action name

    2006-09-22
    285SUGGEST

    This section is almost the only resource I can find on handling SQL LIKE clauses in relation to Rails, and it would be much improved if it had some more dynamic code used in the examples on this page. ie: instead of hardcoded:
    { :conditions => “name like ‘i’”}
    it would be better of having a dynamic variable passed into one of the examples instead, since the general convention: { :conditions => [“name like ‘?’”,variable ] } does NOT work and generates the following code
    WHERE name LIKE ‘’variable’’.
    So, in other words, there’s no guidance anywhere (AFAIK) to how to work around this issue in Rails, and AWDWR is the place where this info should exist.

    2006-09-22
    85TYPO

    “Figure 7.2: Catalog with Layout Added” still shows an old picture with the prices stored as integers. This might confuse some readers comparing their result to the picture.

    2006-09-22
    538TYPO

    Misplaced comma in the following code

    ActionMailer::Base.server_settings = {
    :address => “domain.of.smtp.host.net”,
    :port => 25,
    :domain => “domain.of.sender.net”,
    :authentication => :login,
    :user_name => “dave”,
    :password => “secret”,
    }

    there is a dangling comma.

    Line reads :password => “secret”,

    where it should read

    :password => “secret”

    2006-10-04
    392SUGGEST

    In your second rule (routes_with_names.rb), the last line of that rule is “show_article_:month => nil”. If this is correct, I would explain to the reader the purpose of this construct.

    (Dave says: that’s a typo)

    2006-09-22
    247SUGGEST

    Some mention or coverage of the new dependencies mechanism.

    Configuration during the intializer:
    Rails::Initializer.run do |config|
    config.autoload_paths += Dir[RAILS_ROOT + ‘/app/models/*/’]
    config.load_once_paths -= Dir[RAILS_ROOT + ‘/vendor/plugins/awesome_form/lib/’]
    end

    Troubleshooting with logger or console as some existing applications bound to deprecated Reloadable might break:

    - Dependencies.log_activity
    - Dependencies.loaded.grep /something/
    - Dependencies.load_paths.grep /something/
    - Dependencies.load_once_paths.grep /something/

    Tips or guidelines for plugin users / authors about duck typing base classes in init.rb or /lib/*.Many popular plugins break after the first request.Reference to account_location or ssl_requirement plugins - include SslRequirement versus a class_eval block or duck typing of base classes to inject functionality.

    (Dave says: configuration information is in the 1.15 Configuration appendix, and I’d added information on ssl-requirement to the security chapter)

    2006-10-17
    297TYPO

    In para. beginning “There are times when you want …”, in sentence "The new model object will be initialized so
    that it

    2006-09-22
    76TYPO

    The 3rd paragraph, 2nd line on page 76 reads “the .rhtml files we’re created so far” should maybe read “the .rhtml files we’ve created so far”.

    2006-09-22
    121OK

    The ‘total_items’ method on this page and the referenced source (http://media.pragprog.com/titles/rails2/code/depot_n/app/models/cart.rb) seem not to be working correctly.
    Rails complains: undefined method `sum’ for []:Array.
    There’s no trouble with (analogous to the ‘total_price’ method):
    def total_items
    @items.inject(0) { |sum, item| sum + item.quantity }
    end

    Besides that, I love the book!
    Cheers,
    —t

    (Dave says: you need to update your version of Rails)

    2006-09-22
    322TYPO

    2nd para “we can contruct” should be “we can construct”

    2006-09-22
    85OK

    Where is says “we need to add to our depot.css stylesheet” is misleading. If the user already downloaded the stylesheet, its complete. A shorter version of the stylesheet was never shown. It would be more accurate to say “we need to use more of the features in our depot.css stylesheet”

    (Dave says: the chapters are written as a narrative, so I’m assuming the reader is following along, rather than downloading.)

    2006-09-22
    125TYPO

    “the entire catlog” should be “the entire catalog”

    2006-09-22
    283TYPO

    You’re missing the closing square bracket on the line:

    pos = Order.find(:all,
    :conditions => [“name = :name and pay_type = :pay_type” , params[:order])

    Should be …,params[:order]])

    2006-09-22
    299SUGGEST

    It would be very helpful if the use of params[:order] in the last two examples was made clearer. There is no indication of what type of object this is, or where it comes from. It seems to suggest that an Order object is used in the :conditions parameter, but trying to do a search with an object as a parameter throws all sorts of errors.

    2006-09-22
    299OK

    Using a colon inside of the quotations as shown in the examples causes a syntax error:

    >> orders = Participant.find(:all, :conditions => [“name = :name”, order])
    ActiveRecord::StatementInvalid: DBI::DatabaseError: Execute
    OLE error code:80040E14 in Microsoft OLE DB Provider for SQL Server
    Line 1: Incorrect syntax near ‘:’.
    HRESULT error code:0x80020009
    Exception occurred.: SELECT * FROM orders WHERE (name = :name)

    (Dave says: maybe a problem with the SQLServer adapter)

    2006-09-22
    1OK

    So, if I’m on the books’ page 91, which in Adobe Acrobat is really page 102 because of the table of contents and such, a wierd thing happens. I click on the “report erratum” button and it takes me …./add?pdf_page=91 but the Existing Erratta is listed for something around page 80. Hmm…

    (Dave says: that probably just means that someone entered the page number manually, and they used the viewer page number, and not the book page number)

    2006-09-22
    92SUGGEST

    (PDF pg 104 for page numbered 92) In the last sentence before ‘Carts and Sessions’, you should mention that ‘restart your application’ means ‘restart the webbrick server’ in this case. ‘Restarting’ has not been mentioned.

    2006-09-22
    329SUGGEST

    This class hierarchy leads to a classic problem. What if a manager is also a customer? Or what if a manager becomes a sales person? That’s why “Manager”, “Customer”, “Secretary” are better seen as roles (ie: role attribute of the class Person).

    (Dave says: true. I personally never use STI for just this reason—there are very few true inheritance relationships in the world.)

    2006-09-22
    94OK

    It is possible I am missing an unexplained, subtle point. The line "product = Product.find..." makes product a member variable of the store. It should probably be a local variable (no ). Store.product really makes no sense, and causes subtle confusions later with Store.cart.items[].product and Store.cart.cart_item[].product.

    2006-09-22
    199TYPO

    # and a

    with a

    # child

    assert_select “div.cart > div#cart-title”

    should be

    # and a

    with a

    # child

    assert_select “div.cart > div#cart-title”

    2006-09-22
    194SUGGEST

    This is probably better written using assert_tag directly.
    assert_tag “form” ,
    :attributes => {
    :action => “/store/add_to_cart/993” ,
    :method => “post”
    }

    Maybe change that to assert_select since assert_tag is deprecated.

    2006-09-22
    477TYPO

    "If any errors are returned, the generated HTML will be wrapped in

    tag with class=“fieldWithErrors”." "

    tag" should probably be either "wrapped in

    tags" or "wrapped in a

    tag"

    2006-10-04
    55SUGGEST

    I think the first edition of the book had a more helpful discussion of creating databases, because it also showed you how to grant access to a particular user, which you’re always going to need to do. The current discussion assumes that there is a root mysql login that requires no password, which means you don’t have to show people how to edit the databases.yml file, except that you’re almost never going to be in an insecure situation like that in real life! None of my mysql installations are in that state, so I had to refer back to the first edition for a quick refresher on the grant syntax.

    I think it’d be a real service to readers to keep the presentation at that level of detail in the second edition.

    (Dave says: it’s in the new deployment chapter (to be released soon))

    2006-09-23
    0SUGGEST

    Can you talk about rake db_schema_import? When should I use it?

    (Dave says: it doesn’t form part of my workflow, so I’ve probably not going to mention it)

    2006-10-04
    226TYPO

    “If you’re using Apache or LightTPD,…” should be “If you’re using Apache,…”, since immediately above you describe what to do for LigHTTPD.

    2006-09-26
    116ERROR

    Not so much an error as and oddity. You use this line:
    page.replace(“cart”, :partial => ‘cart’ …
    So, what is with the mixed types of quotes? If they are different, it would be nice to have a note for the non Ruby expert. Otherwise, make them the same so I have less to think about at once.

    2006-09-26
    185TYPO

    assert_raise is missing a closing parenthesis

    2006-09-26
    78TYPO

    A tiny point: In the boxout, end of 3rd para:
    ‘These POST requests are permitted side effects ’
    Is mildly abiguous, needs to read ‘permitted to have’ or ‘may have’.

    2006-09-26
    185TYPO

    assert_raise(ActiveRecord::RecordNotFound { Pruduct.find(bad_id) }

    Should be Product.find(bad_id)?

    2006-09-26
    58TYPO

    A very minor correction to the output given by the “rake db:migrate” command where you say "(saying something like in /Users/dave/work/depot), it should probably read: (saying something like in (/Users/dave/work/depot) ) as the command reports this path in parenthesis.

    2006-09-26
    61ERROR

    You say “Open the file 001_create_products.rb in the db/migrate directory, and you’ll see two (empty) Ruby method definitions:” . . . In reality, the method definitions aren’t entirely empty, but more stubbed out with some basic functionality. The self.down method even drops the table . . .

    2006-09-26
    176TYPO

    3rd para, penultimate sentence:
    ‘Although any remaining test methods will test’ - meaning?

    (Dave says: Stray sentence deleted)

    2006-09-26
    191OK

    It may be a small point due to my having been reading for a while, but I think the description of the get method would be better placed before test_index_with_user, since it took a while for the penny to drop that the test module was automatically setting the session variable, from the third parameter. The description makes that clear.

    (Dave says: it does actually say that in the description of the test_index_with_user method on 190)

    2006-09-26
    197TYPO

    Pseudo Classes para.
    ‘Pseudo-classes alllow typically allow’ should read
    ‘Pseudo-classes typically allow’

    2006-09-26
    223SUGGEST

    Last paragraph: There are parenthesis around where you’re saying that “in this case you must not be using subversion”. But, in reading through not looking for gotchas, it really reads like you’re supposed to do that ‘svn up’ command in the event that you are in the situation where you don’t have your rails project under subversion. E.g., the second approached referred to in the parenthetical statement is the ‘svn up’ command. And, I don’t see that second approach listed anywhere else.

    Just think it needs to be clearer these instructions are not going to work if you’re not using subversion. I’d probably throw in the ‘svn co http://dev.rubyonrails.org/…’ command for people not using subversion.

    It’s very frustrating when I’m learning a new technology only to have to stop and learn another new one to get that first one up and working. Which I imagine, most of the people who aren’t using subversion already are going to be in that position.

    (Dave says: I share your frustration: it’ll be better when the core team eventually releases 1.2)

    2006-09-26
    92OK

    In working through the depot example, I ran into a head-scratcher when I got to page 98. rake db:sessions:clear didn’t seem to be doing anything, and I continued to get the NoMethodError.

    I finally cleared this by restarting the webserver.

    Should the discussion of editing app/config/environment.rb to change how sessions are stored instruct the reader to restart the server?

    (Dave says: I believe it says that on page 93)

    2006-09-26
    30OK

    The book shows script/server starting webrick. However edge rails (and presumably rails 2.0) starts mongrel rather than webrick by default.

    (Dave says: only if you have it installed)

    2006-09-26
    589TYPO

    Last sentence before section 27.3 should read “…you should follow suit—…”

    2006-10-04
    592TYPO

    Last full paragraph on the page reads “…with new versions of Apache, Ruby, and MySQL showing up all the itme,…”

    2006-10-04
    336SUGGEST

    It might be helpful to put in a reminder that join tables should be named with the models in alphabetical order in the ‘The has_and_belongs_to_many Declaration’ section. When I forgot the convention and was trying to figure out what I did wrong, I went to this section, not the earlier sections on foreign keys, so I think readers might find it helpful to have this information there. Violates DRY, but books aren’t programs ;-)

    2006-10-04
    502TYPO

    Second paragraph:

    2006-10-04
    149ERROR

    In the code for the add_user method, you add the success message to flash[:notice] instead of flash.now[:notice] as described further down the page. The code in Appendix C on page 625 is correct.

    2006-10-04
    591TYPO

    Last paragraph:

    2006-10-04
    174SUGGEST

    I found the section on test-driven development in the first edition to be very useful. It looks like it has been removed for the 2nd edition. I think it would be a good idea to add it back in.

    (Dave says: I’d love to, but the book is already groaningly big…)

    2006-10-17
    595TYPO

    Third paragraph (just after the properties listing):

    2006-10-04
    594TYPO

    First paragraph on that page
    “which retsricts access”
    needs to be
    “which restricts access”

    2006-10-04
    509TYPO

    Generraly, spelling

    2006-10-04
    510TYPO

    exampe, spelling

    2006-10-04
    595TYPO

    For consistency’s sake, the example hostname of the :db role needs to be your.host.com as well.

    2006-10-04
    1SUGGEST

    Please add something that describes how to add SSL support to selected actions. I have tried out all the suggestions I could find in Google and none of them seem to work completely. Either I stay in HTTPS forever (including actions that should not) or I lose HTTPS when I press a submit button of a form.
    Thanks in advance.

    (Dave says: documented in the Security chapter (to be released in 1.15)

    2006-10-16
    498TYPO

    “Prototype support for remoting and DOM interaction”: “remoting” is not a word. :) In fact, it’s a bit hard to understand just what the author meant by that. Is it “server-side DOM interaction,” i.e., trying to get across that the server can send things to modify to the DOM?

    2006-10-04
    86OK

    I see the foot note regarding the use of yield versus @content_for_layout. The author says that, “Reports that yield is preferred are incorrect.”

    I disagree. The following post from the Rails blog also disagrees:

    http://weblog.rubyonrails.com/2006/4/25/use-params-not-params

    (Dave says: that blog post mistated the position. I checked)

    2006-09-26
    22SUGGEST

    Cool to see that you included the Ubuntu Dapper link. Anyhow, I think it’s rather unnecessary to leave the link to Breezy there. About by the time the book is out, Ubuntu Edgy will also be out… and then there’ll be two versions newer than Breezy out. Dapper however makes sense to have there even though it soon will not be the newest version anymore, but that’s because it’s an extra stable and polished so called Long Term Support (LTS) release, which will be supported until 2009. So Dapper is still a very good pick for servers for quite some time. But having Breezy there will just make the book look a little bit outdated from the start.

    If you however feel like you really want to give information about how to install under Breezy, I’d suggest that you’d instead of refering to Ubuntu Linux would refer to a page containing links to howtos for different distros. Many links under “Platform issues” at http://wiki.rubyonrails.com/rails/pages/HowtosInstallation could be included in such a page.

    2006-09-26
    131OK

    (10.1/Relationships Between Models) The “Now, for completeness, …” is confusing. I would suggest change: “After all, each product potentially has many line items referencing it.” to “After all, each product potentially has many line items referencing it, although only one per order.”

    2006-10-04
    589TYPO

    Last sentence of the first paragraph has a gramatical error that states: “…Service-Oriented Architecture
    (SOA) territory on which reams has been written (elsewhere).” It should be “HAVE been written”, instead of “has been written”

    2006-10-04
    595TYPO

    Like eratta #5051, there are actually two instances of using “host.come” instead of “host.com” in the properties list. The first one is on the “set :repository” line and the second is on the “role :db” line as mentioned by the other reader.

    2006-10-04
    595TYPO

    "Once you

    2006-10-04
    72SUGGEST

    suggest potting download link for product model at this point

    2006-10-04
    499TYPO

    “One of the key features of Rails is the integrate development
    stack, which lets you use Ruby from top to bottom of your web application.”

    Missing ‘d’ in ‘integrated’

    2006-10-04
    509TYPO

    More specifically: “This is unacceptable for many people, since tables are the premier way to represent data in an aplication.”

    aplication != application

    2006-10-04
    543TYPO

    “It is no harder to make an Ajax link that a regular one, thanks to the wonders of the helpers.”

    should be ‘than’ instead of ‘that’

    2006-10-04
    594SUGGEST

    “Keep production passwords out of the checked-in configuration
    files.”

    This won’t work with the given instructions. It’s not described how to set up database.yml and where to keep these passwords.

    2006-10-04
    392TYPO

    Fourth para: “There a lot of abstract stuff …”, should be “There’s”

    2006-10-04
    394SUGGEST

    “new” should be listed before “create” since this is the logical order of the requests.

    (Dave says: I have my reasons for this order…)

    2006-10-04
    403OK

    I think the correct restful route for the new action is “/articles;new”, and not “/articles/new”

    (Dave says: /new seems to be correct)

    2006-10-04
    169TYPO

    In the second paragraph, the sentence: “If so, that extenstion will be store in the variable format.” should be “If so, that extenstion will be stored in the variable format.” (store/stored)

    2006-10-04
    586TYPO

    First paragraph: “some tips one things…” -> “some tips on things…”

    2006-10-04
    595ERROR

    The rake task remote:code_deploy doesn’t exist, at least not in Capistrano 1.2.0 and mongrel_cluster 0.2.0. I think you mean remote:cold_deploy

    2006-10-04
    137SUGGEST

    I hardly suggest to put code listings always together on one page. It is way more readable that way.

    At least for the pdf version it would be great because I am always copy and paste from the pdf and not from an additional source file. I would like to stay ‘in text’ so I don’t wanna switch back and forth while reading the content.

    Another hint: if it is possible to format an pdf so, that after copy and paste the indention keep intact it would be a nother plus.

    (Dave says: we do layout at the end. As to cut-and-paste: that’s why we provide download links next to the code: typically PDFs do not retain indentation very well)

    2006-09-28
    590TYPO

    “moving code into production was very much a duct-tape and bailing wire affair” - “bailing” should be “baling” (as in “bales of hay”)

    2006-10-04
    21SUGGEST

    macports has recently taken a debian-like view of ruby gems: general hatred! It

    2006-10-05
    592SUGGEST

    Would it not be prudent to point out that certain package managers (e.g. debian’s apt-get, and osx’s macports) are opinionated against ruby gems? For example read this page (http://pkg-ruby-extras.alioth.debian.org/rubygems.html).

    I know that both apt-get and macports now want you to bypass gems altogether, and use their package manager to install gems. This currently sucks, as not all gems are available as packages - for example, mongrel isn’t currently available as a macport port.

    I would suggest to roll your own ruby and ruby gems, and use package managers for everything else.

    (Dave says: JDD has addressed this on his latest blog posting. http://blog.duncandavidson.com/2006/10/updated_sandbox.html)

    2006-10-05
    593OK

    installing rb-rubygems is reported not to work on fresh installs of macports.

    This chap’s blog has some scoop on the matter: http://blog.leenarts.net/2006/09/22/error-installing-rails/

    (Dave says: so has James: http://blog.duncandavidson.com/2006/10/updated_sandbox.html)

    2006-10-05
    592SUGGEST

    Is there any chance you could explain briefly what the termios library is for, and why we need it?

    2006-10-04
    591TYPO

    Last paragraph: “seting”

    2006-10-04
    593SUGGEST

    Debian and Ubuntu users will want to follow these suggestions to get the Mongrel installation to work: http://mongrel.rubyforge.org/docs/debian-sarge.html

    2006-10-04
    107OK

    @items.sum products this error:

    NoMethodError in Store#add_to_cart

    Showing app/views/store/add_to_cart.rhtml where line #13 raised:

    undefined method `sum’

    (Dave says: you have to be running Edge Rails)

    2006-10-04
    593SUGGEST

    Would it be at all possible to briefly describe what the -y flag does when appended to the gem command?

    2006-10-04
    511TYPO

    Opening of second paragraph under subsection “remote_function” should start “Lets” instead of “Let”

    2006-10-04
    169OK

    ActionController::Routing::Routes.draw do |map|
    map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’
    map.connect ‘:controller/:action/:id’
    map.connect ‘:controller/:action/:id.:format’
    end

    that change doesnt allow you to load xml/html based on the url. I stop and started the application, but it has no affect.

    (Dave says: you have to be running edge rails)

    2006-10-04
    613601TYPO

    Repetition in the second sentence of the page containing the name of the chapter ‘Introduction to Ruby’: “Instead, we hope to to explain etc.” I think you’de better to remove one of the ‘to’

    2006-10-04
    619607OK

    First sentence of the page, jsut under the title : “Private and Portected”. “A class’s instance methods are public by default” should be “Class’s instance methods are public by default”.

    2006-10-04
    594TYPO

    "Use firewalls and the database

    2006-10-04
    285TYPO

    in “Using Like Clauses” both the first example of what not to do

    1. Doesn’t work
      User.find(:all, :conditions => [“name like ‘?%’” , params[:name]])

    and the second example of what to do

    1. Doesn’t work
      User.find(:all, :conditions => [“name like ?” , params[:name]+“%” ])

    have comment headings of “# Doesn’t work”

    believe the second one should have a comment changed to

    1. Works when assembled first

    or some such variant

    thanks!

    2006-10-04
    61SUGGEST

    “The migration has a descriptive name (create_products) prefixed with a sequence number (001) and with the file extension (.rb, because it’s a Ruby program).” doesn’t sound right to me. It sounds like both the sequence number and the extension are _pre_pended to the descriptive name.

    2006-10-04
    261ERROR

    Reader Claus Dahl’s suggestion was not tested thoroghly, and should probably not be used at all. It has the following problems with it:

    1) the filename parameter must have an extension (“*.yml”)
    2) it will not honor any ‘id’ parameters you specify in the Yaml files, which will result in breaking any associations you may have thought you had. (Very painful to debug if you’re not using foreign-key constraints!) (mysql 4.0.26 and rails 1.1.4)

    This becomes an issue when your data migration is of any significant size if, for example, you created your yaml files by exporting database data originally from scaffolded forms (as you might do if you are using the same files for fixtures).

    Rather than doing what the book initially suggested (Fixtures.new), or Dahl’s code, I suggest using Fixtures.create_fixtures(folder_from_rails_root, file_basename) which is DRYer and shorter (one stament rather than two).

    I found an example of its usage in the rails rake file [rails_gem]/tasks/databases.rake under the task for db:fixtures:load, which has the same intended effect as what the book is presenting.

    2006-10-04
    107OK

    I too was suffering the problem described in #5099, but it turns out that my edge rails wasn’t really edge.

    I found MUCH better instructions on how to install edge rails here at SitePoint: http://www.sitepoint.com/blogs/2006/07/11/installing-and-managing-edge-rails/

    The authors would do well to incorporate some of the instructions, as the ones currently in the book are not clear enough.

    (Dave says: edge rails won’t be necessary once 1.2 is out. I’d rather not focus on it in the book)

    2006-10-04
    81SUGGEST

    In Chapter 7’s, “In this chapter, we’ll see:” section, “writing helpers” is listed. However, I don’t see anything about writing helpers in the chapter. There are several examples about using built-in helpers, though.

    2006-10-04
    196TYPO

    Last line on page, p#some-id, “#some-id” is in green as if it’s part of the comment. It’s actually part of the selector. Momentarily confusing. Same coloring partway down next page.

    (Dave says: unfortunately, really, really hard to fix without including a full parser in our build system)

    2006-10-04
    585ffSUGGEST

    I suggest to change the structure of the book for the last two chapters. The two chapters run under the section “Rails framework”, where the other chapters on active records, views etc fit nicely. I suggest to put the last two chapters under a header “Deploying Rails: Getting your Projects into the real world”, describe the production server setup in one go first, then deployment using capistrano, and finally the securing the rails.

    2006-10-04
    388DEFER

    Would be nice to see a file upload example in rest.

    388DEFER

    Would be nice to get some information about the cache module + rest.

    593ERROR

    On Suse Linux, the -y flag does not work for gem install

    2006-10-04
    594TYPO

    What is the difference between:
    /deploy/path/current (for mongrel_cluster)
    /path/to/your/application (for capistrano)

    2006-10-04
    589TYPO

    Last paragraph: "It

    2006-10-04
    403TYPO

    Last Element of Figure 20.1 method shouldn’t method name be comment_url() and not comment_url_url() ?

    2006-10-04
    21TYPO

    Para 2 line 6

    “MacPorts was stilled called Darwinports”

    Should be still, not “stilled”

    2006-10-04
    22SUGGEST

    Suggestion for footnote 6 (Tab completion for Windows).

    Instead of fiddling with the registry, once can use the Microsoft TweakUI power toy (available at http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx)

    to set the tab completion on the command line. This is much safer than the registry editor.

    2006-10-04
    23OK

    Your comment that Emacs is not ideal for Rails development is incorrect. The excellent Rails modes that are available for Emacs are more than sufficient and provide most of the features that an IDE editor would have.

    See link: http://wiki.rubyonrails.org/rails/pages/HowToUseEmacsWithRails

    In addition, the ECB mode handles the project/file management aspects.

    (Dave says: as an Emacs user for the last 20 years, I’d have to disagree: it’s horrible compared to other tools. I still use Emacs for most other stuff, though)

    2006-10-04
    435TYPO

    First paragraph (after code sample): “Around filters are wrap the execution of actions”.

    2006-10-04
    435TYPO

    Second para, second sentence: "For example, here

    2006-10-04
    436TYPO

    First para., third sentence: “It records the time, then the yield statement on line invokes …”

    I believe there’s a missing line number referring to the code sample.

    2006-10-04
    437TYPO

    In footnote 13: “Note that at the time of writing the Rails API documentation is incorrect when describing this
    sequening.”

    Should be “sequencing”, I believe.

    2006-10-04
    xiTYPO

    Grammatical error: Paragraph 2 of the Preface to the 2nd editiion includes this sentence: “It is used as the basis for any number of new, exciting, web sites.” The comma after “exciting” should not be there.

    2006-10-04
    594OK

    minor detail: you generate the capistrano cluster yml conf file - before the project even exists in the deployment directory. This results in the following error when you try to generate the conf:
    mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 2 -c /usr/local/rails/fonefu2
    !!! Path to config file not valid: config/mongrel_cluster.yml
    cluster::configure reported an error. Use mongrel_rails cluster::configure -h to get help.

    Bit of a chicken and egg, since I guess you need to perform this step before you deploy, right?

    I am assuming that you are deploying from a pc (not the same as the server).

    (Dave says: JDD believe that you’re probably not in the application’s directory at the time you run the command)

    2006-10-05
    595TYPO

    Third new para.: “When you execute this command, Capistrano will prompt your for your server’s…”

    2006-10-04
    599TYPO

    First continued para.: “For example … of your system. IE, more of the request time will be spent in Rails than in waiting on the database or filesystem …”

    Not proper usage. Should read “… of your system, i.e. more of the …”

    Even still, the sentence is a bit awkward.

    2006-10-04
    30SUGGEST

    How can rails find lighttpd? Just a small mention of what file it looks for would be helpful. I’m running Dapper Drake.

    (Dave says: we’re pretty much abandoning lighttpd in this edition of the book)

    2006-10-04
    31SUGGEST

    4.2, first paragraph: Dave speaking? Who was speaking before? When does Dave stop speaking?

    (Dave says: actually, I wrote the whole thing, except where is explicitly says otherwise…)

    2006-10-04
    543SUGGEST

    Can you add something on testing with Ajax 2.0?

    (Dave says: unfortunately that’s just too big a topic to cover in a chapter like this)

    2006-10-18
    593SUGGEST

    It is ambiguous throughout some of this chapter whether commands are supposed to be entered on the development computer or on the server. Perhaps outline specifically which machine we’re using at the time. Some footnotes on how these commands might differ for Windows users (on their development PC not the server) would be helpful.

    (Dave says: good point)

    2006-10-04
    427TYPO

    Declaration not declarion

    “If you put the same declarion inside a particular controller, you localize the
    effect to that controller.
    class RssController < ActionController::Base”

    2006-10-04
    594SUGGEST

    You need to definately clarify that /deploy/path/current needs to have the path to your app plus CURRENT at the end of it. Spend 2 hours trying to figure out why I was getting path not found errors referring to the mongrel log file.

    2006-10-05
    141OK

    Let me play Joe here.

    In the migration to create the line_items table, execute is used to establish foreign key constraints. Isn’t this, potentially at least, dependant on the underlying database manager. The MySql statements might be different that for other databases, and foreign key constraints might not even be supported by some database managers.

    Are there ways to handle such issues when using functions not directly supported by ActiveRecord?

    (Dave says: not that I know of. You have to have database-sepcific functions somewhere, and if the core team don’t want them in AR, then we have to put them at a higher level. That’s why the fk abstraction is a good one)

    2006-10-05
    498TYPO

    In the first paragraph, the word ‘principal’ is used incorrectly twice. A ‘principal’ as a noun is always a person. A ‘principle’ is a rule or standard.

    2006-10-05
    501TYPO

    The description of the code fragment here (search_demo.rhtml) addresses the lines in a different order than presented here. I suggest moving :complete after :before and :with after :url to follow the description.

    2006-10-05
    511TYPO

    The header for the 2nd paragraph should be ‘link_to_function’ and not ‘link_to_fuction’.

    2006-10-05
    310TYPO

    section 18.2, second line:

    .. You indicate these relatonships ….

    should be “relationships”

    2006-10-09
    598TYPO

    http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

    I think it should be mod_proxy_balancer

    2006-10-09
    516TYPO

    Generaly, your initialized page will… => Generally misspelled.

    2006-10-09
    460TYPO

    Third paragraph: “There are come conditional linking methods that generate hyperlinks if some …”

    2006-10-09
    461TYPO

    Fifth para.: “As a weaker form of obfuscation, you can use the :replate_at and :replace_dot …”

    Should be “replace_at”

    2006-10-09
    462SUGGEST

    Third para., third sentence: “… onto a separate box or to different locations on the current box …”

    For clarity and consistency, the proper term “server” should probably be used in place of the slangier “box.” You can’t really assume that everyone knows or uses that term.

    (Dave says: no better way to learn that to be exposed to it… In general, I write in my voice. Sometimes it can be obscure, but I hope the other times make up for it… )

    2006-10-09
    469TYPO

    First para.: “All form builder helper methods take at least parameters: the name …”

    “Parameters” is ambiguous here. Should it be “at least one parameter”?

    2006-10-09
    229SUGGEST

    In Figure 14.3 Naming Converntions, I’d list the Controller naming in the following order: URL, File, Class, Method, Layout. Specifically, File, Class, Method flows better.

    2006-10-12
    238ERROR

    Coloration of output from count.inspect is wrong on second line… looks blue, but it should continue the green

    (Dave says: the highlighter does it’s best, but it sometimes messes up)

    2006-10-09
    88OK

    The code listing for the default admin.rhtml shows

    <%= yield :layout %>

    whereas my file only says

    <%= yield %>

    (Dave says: I changed it… :)

    2006-10-12
    293SUGGEST

    in version 13, Looks like the full section talking about with_scope is gone. Not sure if it is on purpose or not. in version 12, it has 3 - 4 pages talking about this.

    (Dave says: that’s right. DHH is deprecating its use)

    2006-10-09
    594SUGGEST

    It would be helpful to spell out what is, and perhaps more importantly isn’t, frozen in rake:freeze:gems beyond the rails framework code. Do things like mongel, database adapters, plugins? I did a 10 minute google search and couldn’t find the answer myself, which might be a litmus test that the answer isn’t obvious (or I stink at google).
    What about if you want to freeze only a subset of plugins?

    (Dave says: it freezes just Rails. Plugins are already a part of your applications tree, so in a sense they are already frozen)

    2006-10-18
    489SUGGEST

    But why are those components so heinous? As a non natve speaker, what is heinous? Can you use a more understandbale word?

    (Dave says: http://dictionary.reference.com/browse/heinous)

    2006-10-09
    510TYPO

    conditions_by_like box says “from above” while the code is actually below

    2006-10-11
    510SUGGEST

    conditions_by_like is interesting, but users should be warned that it could be a very long query on large datasets, because SQL cannot use indexes on wildcards before and after a search string: “search”

    (Dave says: the same warning applies to many Rails queries. I worry that highlighting performance here will imply that other places, where I don’t mention performance, are immune from problems)

    2006-10-11
    233TYPO

    At the bottom of the page, the note (3) shows depot>script/breakpointer…. I think it should be depot>ruby script/breakpointer….

    (Dave says: I keep forgetting o=about Windows :)

    2006-10-09
    377TYPO

    In the third paragraph after the title “Playing With Routes”, the second sentence, you have, “we can access this from via the Routes constant”. You should drop the word “from”.

    2006-10-09
    245SUGGEST

    I don’t see any explanation on how to use db:migrate to set up the production database. I found it on the ruby on rails wiki:

    $ export RAILS_ENV=production
    $ rake db:migrate

    But I think it should be noted in this book.

    (Dave says: we don’t recommend the use of migrations in production)

    2006-10-09
    552SUGGEST

    The header and footer on chapters 24, 25, 26, Appendices A and B, and the Table of Contents is grey. Every other part of the book has the header and footer as red.

    (Dave says: red = new, gray = old)

    2006-10-09
    483OK

    You mention how to handle submitting/editing multiple copies of the same model on one form.

    Unfortunately, Rails has a bug where some AR form helpers don’t generate the proper HTML to support this. Namely the date helpers - they ignore the :index and [] modifiers.

    There are bugs filed against this in the Rails Trac but as of now, the patches haven’t been applied, even to the trunk.

    (Dave says: I’ll document it as it should be: I’m assuming they’ll get fixed soon)

    2006-10-09
    248SUGGEST

    When you run ‘rake db:migrate’ does rails run all subclasses of Activerecord::Migration within any rb files in the migrate directory, or do you have to specify somewhere which migrations to run?

    (Dave says: you run files created using script/generate migration…)

    2006-10-09
    547TYPO

    misspelling: ‘fromr’ should be ‘from’

    2006-10-09
    390SUGGEST

    To what do you set the environment variable ?? dave, joe or
    susan?? and what about phred ?

    (dave says: to the part that identifies the application)

    More so, what if your application needs

    http://megablogworld.com/dave/public/blog
    http://megablogworld.com/dave/special/blog

    (Dave says: that’s regular rooting)

    2006-10-12
    107TYPO

    First bullet under ‘Playtime’ contains “incremement”

    2006-10-09
    106OK

    As the existing errata suggests that inject was replaced with sum in cart.rb however sum does not work..It could be that sum is only avaialble in Edge rails but it seemed like such a primitive method. I replaced it with inject and it works.

    (Dave says: sum is only available in edge rails)

    2006-10-09
    482TYPO

    parameter not paramater

    ————8<—————
    However, form_for has a variable-length paramater list

    2006-10-09
    489TYPO

    I think you mean “Unlike ..” not “Unlink ..”

    If you

    2006-10-09
    381OK

    The route that handles month/day/year confuses me because it appears to initialize :day and :month to nil (after the :requirements keyword). Wouldn’t this replace the day and/or month that is in the URL? Some discussion on this would help me and possibly others.

    (Dave says: it’s discussed two pages earlier)

    2006-10-12
    595TYPO

    “an front end server”?!?

    2006-10-09
    493TYPO

    …you use yield :layout tpo embed…

    ‘tpo’ should be ‘to’

    2006-10-09
    309SUGGEST

    The text says "A one-to-one relationship might exist between orders and invoices: for each order there

    2006-10-09
    387TYPO

    In the “Options” listing must read “:skip_relative_url_root” instead of “skip_relative_url_root”.

    2006-10-12
    476ERROR

    The reference in new.rhtml to model object name :details in the line
    <% fields_for :details do |detail| %>
    seems to be in error. The name of the actual object created in the “new” action is “detail” (singular). If this is corrected, also need to change the reference to params[:details] in the “create” action.

    (Dave says: the view is correct—it is the new(0 action that should have ‘details’)

    2006-10-12
    403SUGGEST

    @article_id = params[:article_id] seems to be duplicated (in the “find_article” and “new” methods). As far as I know, the one in the “new” method is redundant, because “find_article” is going to be called first.

    2006-10-12
    409TYPO

    A parenthesis is lost after “(params, request, and so on”. It must read “(params, request, and so on)”.

    2006-10-12
    411TYPO

    Dave refers first to four ways of respond to a user. But, in this phrase, it refers to only three ways:

    “We’ll look at these three in more detail shortly.”

    2006-10-12
    293SUGGEST

    shouldn’t you use find_all_by_name while finding the five texan daves
    (in stead of find_by_name)?

    2006-10-09
    618OK

    Suggestion
    the example
    if line =~ /P(erl|ython)/
    puts “There seems to be a perturbation in the force”
    end
    is cute, but not as instructive as something like
    if line =~ /P(erl|ython)/
    puts “There is a Perl or Python in this line”
    end

    2006-10-12
    173SUGGEST

    Hi congratulations, the book is great!!!

    First let me introduce myself, my name is Giantiago David, I am an engineer from Brazil and have being developing web application as a spare time job for 7 years so far. I am amazed with RoR!

    Here goes a suggestion : show a real example on a bug that can easily be detected with the testing. For a new guy like me, testing looks like very very exoteric stuff. It should be very simple and illustrative. Put it right at the begining of the chapter, in the second paragraph. Readers must think “hum… It can happen and testing will be worthy doing…”

    If you have any question send me a message : giantiago.david@tdr.com.br

    Best regards,

    (Dave says: that’s a good idea, but it would mean introducing an error into the depot application for the test to find, and that would cause all kinds of bug reports to flow. You’re right—it would have been a nice thing to add)

    2006-10-18
    91TYPO

    We talk all about set-
    ting up session information in Chapter 27, Deployment and Production, on
    page 593, and we

    2006-10-12
    477TYPO

    Third para.: “The create action is responsible to receiving the form data and saving the …”

    Should be “for” instead.

    2006-10-12
    18OK

    “Ruby on Rails. This book was written using Rails version 1.1.2.”

    This sentence needs an update to Rails 1.2 … :)

    (Daves says: when 1.2 is released… :)

    2006-10-09
    479TYPO

    Fifth full para,: “Clearly, we need to change the HTML emited by the text_field and text_area …”

    Should be “emitted” and even then, I think a better word is “produced” since to emit is to “give off, as in vapors, gas, sound, etc.”

    2006-10-12
    109TYPO

    The text as given: It says

    2006-10-09
    30TYPO

    Simple presentation glitch : in the example “code” where WEBrick is started, the end of the last line (#start: pid…) is in another colour, probably because of the #.

    (Dave says: our formatting isn’t perfect… :)

    2006-10-09
    66OK

    I was unable to get svn to work out on my windows computer. The freeze command errored out. Here are the results from my attempt:

    C:\\railsapps\\depot>rake rails:freeze:edge
    (in C:/railsapps/depot)
    rm -rf vendor/rails
    mkdir -p vendor/rails
    svn: REPORT request failed on ‘/svn/rails/!svn/bc/5273’
    svn: REPORT of ‘/svn/rails/!svn/bc/5273’: 500 Server Error (http://dev.rubyonrai
    ls.org)
    rake aborted!
    undefined method `[]’ for nil:NilClass

    I am new to svn and did not try real hard to get it to work. I did search online some for my error without luck.

    At first, I just decided to go without edge and used a float instead of a decimal.

    Later, from home at my Linux (Fedora Core 4) computer, I installed svn (yum install svn) and the freeze command worked fine.

    I have a website hosted by Westhost and they provide rails ( an old version where I had to use “migrate” instead of db:migrate) and ssh access, but there is no svn on those vpn servers. I copied the entire vender/rails directory from the successfully updated Linux box to the hosted site and the adding of the decimal column went fine. Then when I went with the “migrate” command it did it and indicated that migrate was depricated and I should use db:migrate, which gave me a warm fuzzy that I really had upgraded rails.

    Later, I copied the vendor/rails directory from the hosted site to the Windows PC and the column add migration with the decimal went fine there as well.

    It seems to me that svn is not available in all environments and is not always easy to get working correctly.
    It also appears that copying that rails directory into the vendor directory in the application directory structure works. Of course I only have the decimal experience as an indication that this works, but hopefully the other V1.2 required features in the book will also work when the time comes.

    I suggest that the directory structure be made available as a .zip and/or .gz file for downloading and manual placement for those people who are having trouble with svn functionality or access.

    Also I realize there has been an update to the PDF file, and I have not downloaded it yet, but I get the impression that svn and edge have not been modified between the 2 versions.

    Thanks, and otherwise the book is great so far.

    (Dave says: Rails is a constantly moving target—there’s no way I could support any kind of zip file for it. However, svn does indeed work on Windows. It’s a pain during this time of transition: hopefully the core team will have 1.2 out soon and this nightmare will pass)

    2006-10-09
    603TYPO

    Just underneath ‘Step Four: Deploy with Capistrano’, it talks about Capistrano doing “it’s magic” rather than “its magic”.

    2006-10-11
    221OK

    Thanks for the hints on how to use the lib directory. Is there a way to “autoload” files in lib, or in subdirectories of lib, such that they get automatically reloaded on every request in development mode?

    (Dave says: if you’re using Edge, they should get loaded automatically)

    2006-10-12
    305TYPO

    (In the “created_at,created_on,…” section, change `or’ to `of’)
    Make sure the underlying database column is capable or receiving a date, datetime, or string.

    2006-10-12
    305SUGGEST

    In the “created_at,created_on,…” section, the XXX_at and XXX_on columns seem to be synonymous. However, in your first edition, XXX_at and XXX_on relate to a timestamp and a date, respectively. After a few tests on Postgresql, of trying all combinations of column names and the column types, it seems the column type ultimately determines what is saved in the database, obviously. Consequently, the column names obfuscate rails’s action, as they have nothing to do with the type of data (timestamp or date) that gets saved to the DB.

    I think you could clarify Rails’s behavior by stating that the column names (i.e. created_at and created_on) are synonymous. Or, instead of stating, “Make sure the underlying database column is capable of receiving a date, datetime, or string,” you could make a generalization, “Make sure the underlying database column is capable of receiving a date or time[stamp] type.”

    (Dave says: I believe I say that)

    2006-10-12
    261SUGGEST

    instead of yml, you can use the fastercsv library (http://fastercsv.rubyforge.org/) to import CSV files as well.

    (Dave says: indeed—there are many ways of loading data)

    2006-10-12
    67SUGGEST

    Hi your use :decimal (available some time next year in Rails 1.2) for setting the price in our demo depot… in order to this you recommend using edgerails… but when I go to see how to use edgerails… I am recommende not to use it if I am a beginner, which I am… unfortunately, I can see no clear alternative to the decimal option, or link to an alternative.

    As this book is schedualled for autumn (fall) release, and 1.2 rails for spring… may I suggest that an alternative to the decimal is offered for beginners.. thanks =8

    2006-10-12
    85TYPO

    Footer: “…original way or doing it…” should read “…original way of doing it…”

    2006-10-12
    92TYPO

    Last sentence: “…Ruby makes the current session look like a hash…” should read “…Rails makes the current session look like a hash…”

    2006-10-12
    489TYPO

    Second para., second sentence: “… and the
    plugin will authomatically manage storing …”

    Misspelling.

    2006-10-12
    488TYPO

    Last paragraph: “In the template, the image tag links back to action that returns the picture …”

    Either need “the” or “the picture action” here.

    2006-10-12
    460TYPO

    In the second paragraph, second sentence, you have, “As we discussed Section 21.6 …”. You should add the word “in” between “discussed” and “Section”.

    2006-10-12
    59SUGGEST

    After invoking ‘rake db:imgrate’ I was really hoping to know what it did, but I never found out!

    (Dave says: you don’t need to know yet… :)

    2006-10-12
    603ERROR

    In ‘Step 4: Deploy With Capistrano’

    The following text:

    1. On your local computer
      $ cap —apply-to /deploy/path [applicationname]

    causes an error. Reading the Capistrano manual leads me to think that /deploy/path should be /local/project/path

    2006-10-12
    131SUGGEST

    The local variable which is returned an the end of the method is called current_item. However, the last time we saw this method on page 108, the variable used was existing_product.

    The name change makes sense, but you might want to point it out.

    2006-10-12
    559TYPO

    Last sentence:

    2006-10-14
    553OK

    In the third paragraph, third sentence, you have, “e-mail might bounce four days”. You probably want to use “for” instead of “four”.

    (Dave says: I actually meant four, but I see the ambiguity. I changed it to three)

    2006-10-14
    558TYPO

    In the first sentence in the paragraph after, “Delivering Multiple Content Types”, s/receivig/receiving/.

    2006-10-14
    477TYPO

    In figure 22.2, the example edit.rhtml uses form_tag, but on page 478 the form_for is mentioned.

    2006-10-14
    105OK

    Up to “Empty cart” this section works fine. With the changes to store_controller.rb (p.105), add_to_cart.rhtml, and cart.rb (p. 106), I can no longer get /store to work. I downloaded this section of code to ensure it was’t a typo and tried rake db:sessions:clear in the command window.

    My error message when opening localhost:3000/store is:

    Showing app/views/layouts/store.rhtml where line #8 raised:

    You have a nil object when you didn’t expect it!
    The error occured while evaluating nil.items

    It also seems to be a problem with total_price. When you download and run depot_i you get this problem:

    undefined method `sum’ for #

    (Dave says: you need to run edge rails)

    2006-10-13
    79OK

    I notice that the standard ‘test’ data you have supplied includes some HTML such as and

    … this is in the description field.

    The Description has been set with “h(” so that html mark up is converted to HTML entities, obviously no-one wants stray HTML tags in their pretty code… I thought I should bring this to your attention, as you can clearly see the problem in the screen shot displaid on the page =8

    2006-10-13
    194OK

    I think this is an error.
    In the subsection functional testing helper follow_redirect():

    “If the preceding action generated a redirect, follow it by issuing a get request”

    It seems to me it should be a follow_redirect rather than a get.

    (Dave says: this is saying that ‘follow_redirect’ issues a GET to follow the redirect)

    2006-10-14
    228SUGGEST

    NamingConvetions:

    • Mention constants
    • Mention numbers, like Form_104.0
    • Give second set of summaries, e.g., “lower case with underscores: variable names, method names, database fields, database tables (plural), file names, in ”require" statemnts.
      “Mixed case with leading capital”….

    (Dave says: I really don’t want to beat this horse too much more. Thanks, though))

    2006-10-14
    508ERROR

    This is another follow-up to post # 5322.

    OK, so this was not really a technical error with the book after all… Just some missing lines of code.

    Please mention, for the Search Example, that it is necessary to search Google, find an animated .gif called ‘spinner.gif’ and save it in the images directory. Then it is critical to add the following tag to search_demo.rhtml:

    <%= image_tag(‘spinner.gif’, :id=>‘spinner’, :style=>‘display:none;’)%>

    If the image is not on the page, the illustrated javascript will not run!

    From a reader’s perspective, I think there is a difference between a full-blown example, which is complete with all code required to make it work, and a snippet. This section fell somewhere in betweeen. This is a great section, please include all the necessary code to make it work.

    Thanks.

    (Dave says: I added the listing of the layout)

    2006-10-17
    220SUGGEST

    In descibin the /lib directory:
    Consider adding another paragraph to describe rake commands in the /lib/tasks directory. There is nowhere in the book where you give a short example of using rake for all the other tasks outside pure database migration.

    One might want the idea of

    • create /lib/tasks/dba.rake like this one
      task create_development_database do
      sh “mysqladmin -u root create depot_development”
      end
      task drop_development_database do
      sh “mysqladmin -u root drop depot_development”
      end
      $ rake create_development_database

    Small, cute, shows the sh command. Allows your code section to have the miscellaneous missing commands. All is good.

    2006-10-17
    69OK

    Hi Dave. On the note # 7 on the footer, there is a rather happy mention to a difference between MySQL and the other databases. This is not a trivial issue. Implication of this small trick is we are going to have a hard time if we ever go away from MySQL in the future, hunting down this kind of stuff…

    (dave says: that’s why I mentioned it… :)

    2006-10-14
    139TYPO

    Second lead-in paragraph sez "Along the way we

    2006-10-14
    155TYPO

    In the first full paragraph, second sentence: The phrase “but to maintain” seems awkward and incorrect. Should drop the “to”?

    2006-10-14
    412TYPO

    “The above could will generate an error …”

    Should probably read …

    “The above could well generate an error …”

    Cheerios!
    Dave

    2006-10-14
    73TYPO

    Paragraph 2 (the one after the big output listing): “overwriting the controllers functional test” should be “overwriting the controller’s functional test”

    2006-10-14
    457ERROR

    The penultimate example on the page reads:

    <%= number_with_delimiter(12345678, delimiter = “_”) %>

    If this method works like the others, I would expect delimiter to be a symbol, not a variable. If this were the case, the example would read:

    <%= number_with_delimiter(12345678, :delimiter => “_”) %>

    (Dave says: should be number_with_delimiter(12345678, “_”) )

    2006-10-14
    460TYPO

    In the third paragraph (ignoring code blocks), the word ‘come’ should be ‘some’.

    2006-10-14
    116SUGGEST

    I don’t understand the phrase “writing Javascript code in the browser.” Meaning something like “writing Javascript code that the browser will interpret”? It may be clear to everyone else, but it stopped me short.

    2006-10-16
    475TYPO

    contrust => construct

    “These style of helpers are going out of fashion for general forms. However,
    you may still need them when you contrust forms that map to multiple Active
    Record objects.”

    2006-10-16
    1SUGGEST

    Suggestion based on an idea I have for an intranet web site:

    Background:

    - I’m new to Ruby / Rails (still reading Pickaxe and ‘Learn to Program" as well as ’Enterprise Integration’).
    - I can do this in a standard PHP/CGI style and want know how to do / what the ‘Rails way’ to do this is…..

    I am thinking of a document management site for some of our inhouse docs, where they could be created / edited on a web page (they are very specifically block/paragraph structured), stored as a row in a database, and then ‘printed’ to LaTeX -> PDF -> email or file store.

    I guess that a way of firing the LaTeX make script from a Ruby script would be via a system() call but how do I get to that point from a Rails page.

    Each document would probably have its own Ruby program that would use Active Record to grab the appropriate database row, create the LaTeX section source files, and launch the make script on the master LeTeX document.

    I can probably do all this as a cron job, looking for newly updated documents for creation / saving to filestore, but triggering a build for emailing to an author / reviewer is where I am stuck. Of course the author/reviewers should also be able to generate the filestore copies too….

    Maybe a short section somewhere in the deployment chapter could address this?
    (A bit like how you generate the Beta Rails books for me..)

    (Dave says: every application is different. We mostly use background cron jobs for this. Some folks use background drb. Other call system directly from their app.)

    2006-10-16
    492TYPO

    last para on page (Passing Data to Layouts) includes text:
    (because the regulat template is rendered befoe
    which should read?
    (because the regular template is rendered before

    2006-10-16
    519OK

    The download for the modified add_item action is taken from a source file ‘list_controllers’. This is a bit confusing since it suggests you may be using a different controller to handle ajax requests. In fact you are modifying the one that is called list_non_ajax. It looks as if this is a hangover from an example that used separate controllers and views. Perhaps the naming needs revisiting, since you end up calling an ajax enabled list within a controller named list_non_ajax. It may actually also be clearer not to call the controller ‘list’ since there is a possible confusion with the action list used in other examples eg admin/list.

    (Dave says: I believe this refers to a previous version of the chapter)

    2006-10-17
    9OK

    In Fig. 2.1, the characters of embedded text (not the caption) appear as squares, as if the characters were not supported in the current font. This happens only in Preview.app (2.1.0), not in Acrobat Reader (5.0.5). I am running Mac OS 10.3.9.

    The same bug appears in Fig. 2.2 on page 10.

    (Dave says: try rebooting. Preview has some known problems with PDF fonts)

    2006-10-16
    21TYPO

    “I-code-by-twiddling-the-bits-on-my-hard-drive with-a-magnet” is pithy, but short one hyphen.

    2006-10-16
    356SUGGEST

    At the top of the page you tell us how to change the default error messages via code. BUT WHERE DO I PUT THAT CODE? I assume there is some kind of application startup code, and this would be a nice place to mention it.

    2006-10-16
    484TYPO

    There is a note at the end of the second paragraph: “(Note that the parameter list to a Ruby method must be in parentheses if it contains two literal.)” Should “literal” be plural, or is it an adjective, in which case there’s a noun missing at the end of the sentence?

    (Dave says: it should say “literal hashes”)

    2006-10-16
    7967OK

    I have copied and pasted the lines from the book and the zip file:
    class AddPrice < ActiveRecord::Migration
    def self.up
    add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0
    end

    def self.down
    remove_column :products, :price
    end
    end
    I still get the same error:
    C:\\InstantRails\\rails_apps\\depot>rake db:migrate —trace
    (in C:/InstantRails/rails_apps/depot)

    Invoke db:migrate (first_time)

    Invoke environment (first_time)

    Execute environment

    Execute db:migrate
    AddPrice: migrating ==
    — add_column(:products, :price, :decimal, {:precision=>8, :scale=>2, :default=>
    0})
    rake aborted!
    You have a nil object when you didn’t expect it!
    You might have expected an instance of Array.
    The error occured while evaluating nil.[]

    (Dave says: you’re not on edge rails)

    2006-10-16
    85OK

    I think a page is missing. The code for the StoreHelper seems missing in the latest version..

    (Dave says: I don’t believe there is a store helper at this point)

    2006-10-16
    259TYPO

    directory = File.join(File.dirname(FILE), “dev_data” ))
    last bracket is to much, should be
    directory = File.join(File.dirname(FILE), “dev_data” )

    2006-10-16
    460TYPO

    Last paragraph, second sentence:

    I think it should read "…(of the form ‘widthxheight’)

    2006-10-16
    254SUGGEST

    On description of ‘option’ and InnoDB:
    a footnote or note mentioning InnoDB makes ACID transactions work would be good for mere mortals, and an example of how the auto_increment example and innodb options would combine in one statement.

    2006-10-17
    1OK

    More on #5341

    What I am aiming at is a way to launch and detatch the LaTeX make process, yet provide some feedback re the possible time to deliver etc…

    (Dave says: that’s a good question for the Rails mailing list.)

    2006-10-17
    58OK

    When using edge-rails (as required, for now, by the example to run migrations with decimals) on a Debian box, I get a ‘Mysql not loaded’ error on rake db:migrate. Rake connects fine to the DB if I unfreeze edge-rails, but falls over on the decimal.

    If there’s a known issue with MySQL and edge-rails, it would be good to list it, as I can’t find any info on it anywhere else.

    (Dave says: I’ve been using Edge Rails on MySQL for the last year without issues.)

    2006-10-17
    445OK

    code:

    cache_sweeper :article_sweeper,
    :only => [ :create_article,
    :update_article,
    :delete_article ]

    must be:

    cache_sweeper :article_sweeper,
    :only => [ :create, :update, :delete]

    Otherwise don’t work with rails 1.1.6.

    Thanks for your wonderful framework and book!

    (Dave says: I beleiev the correct is correct as it stands: the parameters to :only are the names of actions, and the ones in the book are the action names in the content_controller)

    2006-10-17
    594OK

    The session management script doesn’t work as printed on my Debian install:

    find /tmp/ -name ‘ruby_sess*’ -ctime +12h -delete

    It fails on two points.

    1: +12h is invalid. The version of find I’m using expects +1, meaning +1 * 24 hours

    2: -delete is not recognised as a predicate.

    (Davs says: the syntax is valid on all the find commands I have access to, but clearly there may be differences on different systems. However, at this level I suggest that if you’re running a publicly facing web application you’d probably be wise to become familiar with the basic administration commands on your box. I know that probably sounds snide—it isn’t meant to. System administration is a big and serious topic, and we can’t begin to cover it in a single short chapter)

    2006-10-17
    569OK

    You seem to have removed references to the technique of using Action Mailer to mail errors back to the developer. Is there a reason for this? As you said in your first edition, scanning through log files is tedious and can often lead to serious errors going unfound for long periods of time.

    (Dave says: that technique has been obsoleted by the exception notification plugin, described in the deployment chapter)

    2006-10-17
    555TYPO

    First paragraph of “Email Templates” has double “the”:

    We can customize the the template in confirm.rhtml;

    2006-10-17
    23SUGGEST

    Actually, there is an IDE for Rails, based on Eclipse. It’s called RadRails and it’s currently in version 0.71. Extremely useful. www.radrails.org

    (Dave says: I think RadRails is interesting, but it isn’t yet an IDE for Rails. In fact, it looks as if Visual Studio will come closest, but it still isn;t there either)

    2006-10-17
    426ERROR

    The link in footnote number 8 produces a 404 error.

    8. Available from http://www.deveiate.org/code/e1/Ruby-MemCache.html.

    (Dave says: the link is now http://www.deveiate.org/projects/RMemCache)

    2006-10-17
    497SUGGEST

    Can you explain the current technique for replacing partials more fully please? How does a before filter interact with a partial? How does it pass variables to the partial? How are variables passed to the before filter from the calling code?

    Finding out by trial and error is not successful so far and is taking ages.

    (Dave says: it’s the same technique we used for the shopping cart in the depot application. I added a sentence to that effect)

    2006-10-17
    305TYPO

    created_at, created_on, updated_on
    … Rails applications conventionall use the _on suffix…
    Should be conventionally.

    2006-10-17
    75ERROR

    In the extract from the migration file, the text “s a foundational piece of any project” in the book’s description is italicized. It looks like the parser thinks the apostrophes on either side of it are demarcating a string.

    (Dave says: yes, it does. Nothing we can do about it, though. Sorry)

    2006-10-17
    475TYPO

    On third to last line, last word of line. Seperate is misspelled.

    2006-10-18
    518TYPO

    the statement “(and its act-a-like cousin button_to_helper())” should reference button_to_function, not button_to_helper

    2006-10-18
    675ERROR

    On this page the index lists an entry for start_form_tag, but the corresponding page has no mention of that method. I think it’s deprecated and/or a duplicate of form_tag.

    (Dave says: it isn’t deprecated, but it is longer to type… :)

    2006-10-18
    84TYPO

    “On line 11 we set the page title to a value in the variable @page_title.”

    That’s not really true. Line 11 is in the

    ; this wording makes it sound like you’re setting the

    <p>tag.</p> </td><td>2006-10-18</td><td></td></tr> <tr><td>611</td><td></td><td>OK</td><td><p>At the top of page 611, you say “oddly enough” that J. Duncan Davidson is a freelance photographer. It is not odd at all — many programmers are also photographers. Please simply remove the phrase “—oddly enough—”, and it will be much more accurate. Thank you.</p> <p>(Dave says: Duncan wrote that, so I’ll bow to his words)</p> </td><td>2006-10-18</td><td></td></tr> <tr><td>90</td><td></td><td>SUGGEST</td><td><p>when suggesting play time - do it yourself… for us absolute beginners, it would be kind to make it clear that the answers are in the book somewhere, and maybe offer a crib link… i.e. which page the information may be found. In this case I am refering to the link_to (get the book inage to add to the cart). I did get there in the end, and for sure scar tissue when learning is good, but at the same time I came close to giving up… the hints offered still don’t really make sense, even though I now know the answer. This is not a gripe, but I think it would make for a less stressful user experience LoL… especially for the slightly less robust students. thanks.</p> <p>(Dave says: to be honest, I’m not sure that the answers <em>are</em> always in the book. Sometimes they’re in the API documentation. Playtime exercises are designed to stretch you away from the book’s material. The intent is to simulate the real world, where you’ll be faced with these kinds of challenges. I try to start out with less challenging exercises and ramp them up, but feedback like this is very useful—maybe I’ll revisit them and see what I can do)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>609</td><td></td><td>TYPO</td><td><p>Most of the time you</p> </td><td>2006-10-18</td><td></td></tr> <tr><td>247</td><td></td><td>TYPO</td><td><p>15.8 Unicode support, 3rd paragraph: “(UTF-16 aqnd UTF-8),” => s/aqnd/and/</p> </td><td>2006-10-18</td><td></td></tr> <tr><td>248</td><td></td><td>TYPO</td><td><p>last but one paragraph: “on the otherhand” => space after ‘other’ is missing</p> </td><td>2006-10-18</td><td></td></tr> <tr><td>327</td><td></td><td>OK</td><td><p>Dave, I noticed you aren’t using :after_add type association callbacks in your book. However, if you are thinking of mentioning those, I thought I would share a problem we happened upon. The “orders.build(attributes={})” method does not seem to trigger the association callbacks, when a “<<” would.</p> <p>(Dave says: this seems like a Rails bug report)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>247</td><td></td><td>TYPO</td><td><p>EBCCIC => EBCDIC<br /> “such as ASCII and EBCCIC became common.”</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>600</td><td></td><td>SUGGEST</td><td><p>At the end of 26.3 wouldn’t it be useful to list the idiom of @user.orders.find(id).destroy when talking about safe deletion? Not that this covers all cases…</p> <p>(Dave says: great point—the end of that paragraph didn’t get updated)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>600</td><td></td><td>SUGGEST</td><td><p>shouldn’t 26.4 mention ActionController::Base.hide_actions?</p> <p>(Dave says: I think hide_actions is dangerous—it’s too easy to leave an action off when you come back and edit a controller. I strongly recommend having a private section in controllers and placing non-web accessible actions in it)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>158</td><td></td><td>ERROR</td><td><p>Going from 1.14 to 1.15, the User model (user.rb) seems to have lost the</p> <p>validates_length_of</p> <p>parameter, yet the text still mentions it (“We next check that the password is at least 5 characters…”)</p> <p>Something is inconsistent here.</p> <p>(Dave says: indeed—the text was wrong)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>99</td><td></td><td>SUGGEST</td><td><p>the foot note on this page says that I need to be using EdgeRails to see this behaviour… do I assume that unless I use EdgeRails, I can proceed no further with this project? Or is the error in earlier versions just different… one way or another flushing the sessions from the db, does not make any difference, but I don’t want to spend time chacing ghosts - thanks</p> <p>(Dave says: you need to be running Edge to see the application described in the book run. Quite a few things will work differently or not at all on earlier versions of Rails. Let’s all send in a prayer for a rapid release of 1.2)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>549</td><td></td><td>TYPO</td><td><p>The line “Though this is certainly true, it also misses the point. Fancy UI effects might not be Ajax, but they are certainly Web 2.0, and they are every bit as equally<br /> important to modern internet applications as the asynchronous data transfer is.” has an extraneous “equally”, likely left over from a sentence refactoring.</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>150</td><td></td><td>SUGGEST</td><td><p>(I just realized I’ve been using the incorrect page numbers for my submissions. Starting now, I’m doing it right. Sorry!)</p> <p>In the second paragraph after the add_user action definition, you write:</p> <p>…renders the template associated with add_user (which we haven</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>99</td><td></td><td>OK</td><td><p>Hi I have edge rails running fine now…</p> <p>Unfortunately you are missing an END at the end of the cart.rb. (this may or may not have been the reason why I was getting an error)</p> <p>(Dave says: I don’t see the missing end. Could you email me offline and tell me where it is (or isn’t :))</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>478</td><td></td><td>SUGGEST</td><td><p>The sentence “Perhaps you have a spiffy date-formatting helper that you want to use in all of your controllers” is misleading: you cannot use a helper inside a controller only inside a view. It would be good to point that out explicitly.</p> <p>(Dave says: changed to make it more explicit. Now says:</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>14</td><td></td><td>OK</td><td><p>I know that you state that some Rails features will not be avialable until 1.2. But I would like a brief summary of what the new features are so I can stay clear of them whilst developing my app with 1.1.6. I don’t want to try something and find out after wasted time that its only in 1.2</p> <p>It doesn’t need to be in the book, just at the end of the page on the web site for the book.</p> <p>(Dave says: the Rails source comes with CHANGELOGs, which are the definitive sources of this information)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>38</td><td></td><td>SUGGEST</td><td><p>Just wanted to let you know that the newest version of BBEdit, 8.5, released earlier this month has been updated with support for .rhtml files, and also fills in a lot of the feature gap between TextMate and itself.</p> <p>(Dave says: thanks for the information)</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>99</td><td></td><td>OK</td><td><p>in the footnote you mention that if readers are running an older version of Rails they "might see an error saying</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>607</td><td></td><td>TYPO</td><td><p>26.9 USe SSL to Transmit Sensitive Information</p> <p>should be</p> <p>26.9 Use …</p> </td><td>2006-10-19</td><td></td></tr> <tr><td>68</td><td></td><td>OK</td><td><p>I am using the book to learn Rails.<br /> Everything went smoothly untill I came to page 68 where I was adviced to turn to page 226 to get support for :decimal.<br /> Turning to page 226, and executing the specified command:</p> <p>C:\\InstantRails\\rails_apps\\depot>svn propset svn:externals “rails http://dev.rubyonrails.org/svn/rails/trunk” vendor</p> <p>(all on one line), I got the following error:</p> <p>‘svn’ is not recognized as an internal or external command,<br /> operable program or batch file.</p> <p>Reading further, I found that this probably has to do with something called Subversion - BUT NOTHING HAS TEACHED ME WHAT THAT IS, AND HOW TO INSTALL IT!</p> <p>The svn.exe file is nowhere to be found in the InstantRails directory or any subdirectory thereunder. InstantRails 1.4 was downloaded and installed two days ago.<br /> I am at loss what to do, and my learning experience have come to a complete halt.</p> <p>(Dave says: I’m sorry—we’re still waiting for the core team to produce a public release of Rails 1.2, which the book documents. Subversion is not part of Rails—it’s a version control system.)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>463</td><td></td><td>TYPO</td><td><p>Shouldn’t the erb_trim_mode value at the top of the page include a percent character in keeping with the text description?</p> <p>(Dave says: yes — cut and paste error)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>468</td><td></td><td>TYPO</td><td><p>In the last paragraph, which begins “The :popup, option takes either the value…”, I find the comma after :popup to be confusing and grammatically incorrect. The next paragraph on the next page does the same thing with “The :method, option…”.</p> <p>(Dave says: yup—he comma crept in during indexing)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>145</td><td></td><td>TYPO</td><td><p>I’m not sure if this is a typo or suggestion, but upon reading “We next check that the password is at least 5 characters long.”, I am left scratching my head and assuming that this refers somehow to the new and as yet unexplained attr_accessor declaration…</p> <p>(Dave says: that check is now removed)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>94</td><td></td><td>SUGGEST</td><td><p>Hi Dave,</p> <p>Where you say,</p> <p>“The next time you restart your application (stopping and starting script/server), it will store its session data in the database.”,</p> <p>it’s not mentioned to do it now, so I told myself, well, he’s gonna tell us to do it when it’s needed, because someone could just have flewn pretty quickly over this part of the page. And later on, I got an error due to my lack of doing it before. I quickly found what I needed to do to fix things up, but usually, you would have put that instruction just when it’s needed, not many pages before, so I think it would be better if you’d repeat it just before it’s needed.</p> <p>Thanks for your great work!</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>617</td><td></td><td>SUGGEST</td><td><p>it is very difficult to find the package rb-termios for redhat, fedora, etc. To date I still have not. I’m not sure if it will affect anything yet, but it may be worth noting how to locate this package.</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>7</td><td></td><td>TYPO</td><td><p>In last paragraph of the “Acknowledgements” section the text currently reads:<br /> “if for o other reason”<br /> it probably should be<br /> “if for no other reason”</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>339</td><td></td><td>SUGGEST</td><td><p>A small class diagram and example table (like in the section about STI above) would be great to achieve a better/faster understanding of polymorphic associations. :-)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>392</td><td></td><td>TYPO</td><td><p>“We can demonstrate this using inside script/console by<br /> using the optional second parameter to generate.” Should be either “inside” or “using”, but not both.</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>464</td><td></td><td>SUGGEST</td><td><p>One of the main reasons we put code in helpers instead of views is that it’s extremely difficult to unit test code in a view. It’s easy to test it in a helper.</p> <p>(Dave says: great point)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>97</td><td></td><td>ERROR</td><td><p><%= item.title %> should be <%= h(item.title) %></p> <p>(Just learning rails, but really I’m beginning to feel it’s a design error that it doesn’t escape results of <%= by default.)</p> <p>(Dave says: I believe the thinking is that this would break all the helpers such as link_to)</p> </td><td>2006-10-20</td><td></td></tr> <tr><td>333</td><td></td><td>TYPO</td><td><p>“You can also use the create! method to create a row at the far of of an association.” -> “…at the far end of an association.”</p> </td><td>2006-10-21</td><td></td></tr> <tr><td>125</td><td></td><td>OK</td><td><p>“redirect_to_index” has been depreciated in favor of “redirect :action => :index” People just starting out get confused when the books shows the depreciated way.</p> <p>(Dave says: there isn’t a built-in redirect_to_index—it’s a method I wrote.)</p> </td><td>2006-10-21</td><td></td></tr> <tr><td>443</td><td></td><td>OK</td><td><p>The use of “pass it a block or a filter class” followed by “use a block as a filter”; OR and AS seem to convey conflicting relationships between the block and filter. This is either subtle ruby I don’t yet grok or perhaps an ambiguity. In any case, intriguing.</p> <p>(Dave says: they are two separate things—you can pass it A or B. If you pass it A, …)</p> </td><td>2006-10-21</td><td></td></tr> <tr><td>91</td><td></td><td>TYPO</td><td><p>“Experiment setting various options” should probably read “Experiment with setting various options”.</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>73</td><td></td><td>OK</td><td><p>The footnote is so long that it wraps to the next page. I do not know how this will look work in the printed book, but it is hard to follow in the PDF version.</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>557</td><td></td><td>TYPO</td><td><p><% form_remote_tag :url => {:action => ‘add_todo’} %> at the top of the page should read:<br /> <%= form_remote_tag :url => {:action => ‘add_todo’} %>.</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>108</td><td></td><td>TYPO</td><td><p>Paragraph 2: "Rail</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>110</td><td></td><td>TYPO</td><td><p>“Change the template to display the counter only if it is greater than zero.” This seems impossible to verify through the UI. One must load the page to see whether the value displays; loading the page causes the value to be at least 1; therefore the page will never display with the value hidden.</p> <p>(Dave says: good catch!)</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>626</td><td></td><td>SUGGEST</td><td><p>You mention Trygve Reenskaug as the creator of MCV, giving a little history in the first chapter. In the Ruby appendix, there is no mention of the history or background of the programming language that underlies RoR! Maybe a sentence about Ruby being a modern language developed in Japan by Yukihiro Matsumoto, etc. to give some sense of the flavor and purpose of the language.</p> <p>(Dave says: I could write a whole book on the flavor of Ruby, but in this appendix I really want to be terse. Thanks for sticking of for the language, though)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>627</td><td></td><td>TYPO</td><td><p>Last paragraph of A.1, second to last line - “The third line has a number calculate its absolute value.”</p> <p>(Dave says: perhaps you could amplify what is wrong with this sentence?)</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>48</td><td></td><td>SUGGEST</td><td><p>The last “Playtime” item on this page (concerning using @dirs = Dir.glob(‘*’)) is an interesting exercise, but I do not think we have enough knowledge at this point to actually implement it ourselves. Some help or suggestions regarding how to iterate through each separate filename would be helpful here.</p> <p>(Dave says: Yes. I was trying to stretch folks in these exercises, but this might be too big a jump. I’ve added some explanation)</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>385</td><td></td><td>OK</td><td><p>I didn’t get the result described when I executed the console command "puts rs.routes.map(&:to_s):</p> <p>>> puts rs.routes.map(&:to_s)<br /> #<ActionController::Routing::Route:0x2244bec><br /> #<ActionController::Routing::Route:0x22448b8><br /> => nil</p> <p>(Dave says: are you on Edge Rails. It works here)</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>15</td><td></td><td>ERROR</td><td><p>The two examples about .find that iterate over its result are missing the .each call on the returned array<br /> [Order.find(…) do ..] should read [Order.find(…).each do ..]</p> <p>(Dave says: ouch—I do that all the time. Thanks!)</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>118</td><td></td><td>OK</td><td><p>I keep getting the following fault:<br /> NoMethodError in Store#add_to_cart</p> <p>Showing app/views/store/add_to_cart.rhtml where line #18 raised:</p> <p>undefined method `sum’ for #<Array:0x331fb84></p> <p>(Dave says: please upgrade to Edge Rails)</p> </td><td>2006-10-22</td><td></td></tr> <tr><td>475</td><td></td><td>TYPO</td><td><p>“In fact, Rails for support”<br /> “for” -> “forms”?</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>19</td><td></td><td>TYPO</td><td><p>There is a wrong reference to “Rails 1.1.2”, that should read “Rails 1.2”, as stated in the introduction</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>1</td><td></td><td>SUGGEST</td><td><p>You caution that this book is compatible with rails 1.2, which is great. Do you have a sense though of when 1.2 is due out? I’m not looking for a date per se (I know that it’s done when its done). But a general sense like a week, a month, 6 monts.</p> <p>(Dave says: that’s a question for the core team)</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>247</td><td></td><td>TYPO</td><td><p>Actual: “When Rails store vstrings in Unicode, it uses UTF-8.” Corrected: “When Rails stores strings in Unicode, it uses UTF-8.”</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>165</td><td></td><td>OK</td><td><p>The Product model is changed to say</p> <p>has_many :orders, :through => :line_items</p> <p>but when I run the new who_bought.rxml code on the next page, I get the following message:</p> <p>Could not find the association :line_items in model Product</p> <p>Is there another step I missed?</p> <p>(Dave says: does it work if you (1) install Edge Rails, and (b) download and run the code from our site?)</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>146</td><td></td><td>ERROR</td><td><p>The text says “This forces the assignment to use the salt accessor method…” For clarity, you should say that it’s the ‘salt=’ method, not the ‘salt’ method.</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>45</td><td></td><td>TYPO</td><td><p>the html snippet for the file goodbye.rhtml has no keyword coloring (i.e. it’s all in blue).</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>100</td><td></td><td>SUGGEST</td><td><p>depot> rake db:sessions:clear<br /> Now hit Refresh, and you</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>483</td><td></td><td>SUGGEST</td><td><p>This sentence is unclear to me: “The date stored in @variable.attribute is used as the default value.” How does one go about setting the default value for date_select() or datetime_select()? I wish I had the answer for you :)</p> <p>(Dave says: set a value into the attribute…)</p> </td><td>2006-10-23</td><td></td></tr> <tr><td>474</td><td></td><td>SUGGEST</td><td><p>After reading the docs and trying out some code, I can’t see how “<% form_for :user, :url => { :action => ‘save’ } do |f| %>” is going to result in "</p> <form action="/myapp/save/1234"> <p>". In particular, it is the 1234 at the end that has me stumped. How does form_for know to tack on the 1234 (the id)? I don’t see any options that I’ve given it that would tell it how to do it.</p> <p>(Dave says: the diagram is missing a ‘:id => @user’ Thanks)</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>405</td><td></td><td>TYPO</td><td><p>“will respond appropriate to requests” -> “will respond appropriately to requests”</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>197</td><td></td><td>TYPO</td><td><p>In "assert_select is build around Assaf Arkin</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>201</td><td></td><td>TYPO</td><td><p>In “-an+d (nodes from groups)<br /> Divide the child nodes into groups of a, then select the first node of up to b groups.”,</p> <p>“up to b groups” should read “up to d groups”.</p> <p>(Dave says: good eye)</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>108</td><td></td><td>OK</td><td><p>Code: “def total_price @items.sum { |item| item.price } end”. My Ruby’s never heard of Array#sum, and neither has ruby-doc.org/core. The #inject version mentioned in another erratum (from an earlier revision?) works fine.</p> <p>(DAVE SAYS: INSTALL EDGE RAILS!!!!!!)</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>196</td><td></td><td>OK</td><td><p>section follow_redirect():</p> <p>“If the preceding action generated a redirect, follow it by issuing a get request”</p> <p>I think it should read</p> <p>“If the preceding action generated a redirect, follow it by issuing a follow_redirect request”</p> <p>(Davs says: it issues a GET request to follow the redirect)</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>202</td><td></td><td>TYPO</td><td><p>Pluralize node in:</p> <p>"Once assert_select has chosen a set of nodes, and passed any</p> <p>tests associated with those node,</p> <p>you may want to perform additional tests within that nodeset."</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>216</td><td></td><td>TYPO</td><td><p>“What it calls mocks are really just stubs: faked-out chunks of code that eliminate the need for some resource”</p> <p>Need to finish that sentence up with a “.”.</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>572</td><td></td><td>TYPO</td><td><p>“email that send cover images at attachments’<br /> =><br /> ”email that ‘sends’ cover images ‘as’ attachments’</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>612</td><td></td><td>TYPO</td><td><p>Last sentence of paragraph before “FastCGI vs. Proxying Requests” reads “Well see how…,” but it should read “We’ll see how….”</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>623</td><td></td><td>TYPO</td><td><p>In “Keeping on Top of Application Errors,” there’s an extra “your” in “Add the following your your application controller….”</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>623</td><td></td><td>TYPO</td><td><p>In “Keeping on Top of Application Errors,” “The set up a list…” should be “Then set up a list….”</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>623</td><td></td><td>TYPO</td><td><p>In “Keeping on Top of Application Errors,” “and<br /> described starting on page 562” should be “as described starting on page 562.”</p> </td><td>2006-10-24</td><td></td></tr> <tr><td>240</td><td></td><td>SUGGEST</td><td><p>Recommend giving a more elaborate example on group_by. Like showing the contents of posts and groups. It’d be easier for new users to get a hold the concept of group_by if actual output were given.</p> <p>Also, a more advanced use of group_by would be helpful to see further possibilities of the method.</p> <p>(Dave says: to be honest, I view this group_by as peripheral. The important one is the SQL-based grouping, which I document more fully. However, I’d happily be shown to be wrong (ideally by e-mail))</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>78</td><td></td><td>ERROR</td><td><p>After the admin.html is shown, you have wrote that “The fourth line is responsible for…” but that seems to be a counting without the Doctype. I believe that “The sixth line” would be correct.</p> <p>(Dave says: you’re right—I added the DOCTYPE lines to the generated code. I’ll document that fact)</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>357</td><td></td><td>OK</td><td><p>Don’t think validates_associated has :allow_nil option, even in 1.2 Think you have to use v_p_o to catch for nil</p> <p>(Dave says: it doesn’t document the fact, but my reading of the source is that it does support :allow_nil)</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>635</td><td></td><td>SUGGEST</td><td><p>The section on regexps refers to the “PickAxe book” for a full discussion. This should be linked to the bibliography.</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>109</td><td></td><td>SUGGEST</td><td><p>Once again I plead with you to give the solutions to the ‘play time’ exercises…(at the back of the book) I have not been able get a counter counting, let alone to display on the page and to manipulate it. This is starting to become tortuous, bordering on the unhelpful really, I want to learn, not throw the computer out of the window (LoL)</p> <p>(Dave says: I encourage people to work through the exercises either individually or in a group. Sometimes the group approach works best. I know some folks have met up on the Rails mailing list to work through these exercises. I don’t want to add any more pages to the book for solutions—I think the book has already grown too big :)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>6</td><td></td><td>TYPO</td><td><p>section 1.3, second paragraph begins "It</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>6</td><td></td><td>TYPO</td><td><p>section 1.3, end of second paragraph: “luke warm” should be one word.</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>154</td><td></td><td>ERROR</td><td><p>In Figure 11.1, in the ‘Template’ code, there should be a ‘do’ after ‘form_tag’.</p> <p>(Dave says: good catch)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>492</td><td></td><td>ERROR</td><td><p>In the sidebar ‘Forms Containing Collections’, first code sample, missing ‘do’ after ‘form_tag’.</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>615</td><td></td><td>SUGGEST</td><td><p>Top of the page, it almost sounds like you are implying Windows is a type of Unix. I had to re-read that a few times.</p> <p>Maybe: “and also on” instead of “as well as” ? I don’t know, but it just sounded funny.</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>609</td><td></td><td>TYPO</td><td><p>“The ssl_required declaration lists the actions that can only be invoked by HTTPS<br /> requests. The ssl_allowed declaration lists actions taht can be called with either<br /> HTTP or HTTPS.”</p> <p>s/taht/that/</p> </td><td>2006-10-25</td><td></td></tr> <tr><td>77</td><td></td><td>OK</td><td><p>The description in the add_test_data migration at the top of the page has “a foundational piece of any project’s” italicized, when it should probably be undecorated and surrounded with <em>…</em>.</p> <p>(Dave says: our code highlighter doesn’t do well with %{…} style strings. The fix is pretty much impossible, as it would involve more parsing that we can do. We live with it… )</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>696</td><td></td><td>SUGGEST</td><td><p>The index and the table of content are not bookmarked (I use Adobe Reader). This makes it difficult to get to them.</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>518</td><td></td><td>ERROR</td><td><p>In the “search” partial, you make a call to link_to, with “:post => true”. Isn’t this now, “:method => :post”?</p> <p>(Dave says: interestingly, this is in scaffold-generated code. I’ve reported it to the core team, and fixed it locally.)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>6</td><td></td><td>TYPO</td><td><p>section 1.3, 1st line of 3rd paragraph: “So, this book would not exist without a massive about of help” — English is not my native language, but—was the sentence intended this way?</p> <p>(Dave says: looks like English isn’t my native language, either. Thanks)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>597</td><td></td><td>TYPO</td><td><p>At the top of the page, you refer to “the name parameter”. There is no name parameter in the example cited; it should be referring to “the subject parameter”.</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>607</td><td></td><td>TYPO</td><td><p>“Through” is misspelled as “throuh”.</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>78</td><td></td><td>SUGGEST</td><td><p>There is no download location given for the completed changes to admin.rhtml, only for the admin.rhtml that’s generated by the scaffold (which we already have).</p> <p>(Dave says: no, there isn’t. That is inline code (because of a limitation in the way we include code snippets, and a problem with the way some browsers interpret DOCTYPE. You don’t want to know… :)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>311</td><td></td><td>OK</td><td><p>the output of the query:</p> <p>res = Order.connection.select_all(“select id, ” +<br /> " quantity*unit_price as total " +<br /> " from line_items" )</p> <p>is listed as</p> <p>[{“total”=>“29.95”, “id”=>“91”},<br /> {“total”=>“59.90”, “id”=>“92”},<br /> {“total”=>“44.95”, “id”=>“93”}]</p> <p>however the column order should be id,total</p> <p>(Dave says: hashes are unordered)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>638</td><td></td><td>SUGGEST</td><td><p>Finding reference documentation on Rails (beyond the api) is <strong>difficult</strong>. A major reason why I bought the book was that I thought I would find documentation of for instance rake tasks. The least the book could have is a survey of where documentation can be found.</p> <p>Great book!<br /> Jonas</p> <p>(Dave says: I’m not sure there is any reference documentation beyond the API and the stuff here…)</p> </td><td>2006-10-26</td><td></td></tr> <tr><td>1</td><td></td><td>SUGGEST</td><td><p>I’ve just noticed that ActiveRecord::base::abstract_class isn’t documented anywhere in the book as it currently stands. I’ve found it to be very useful as a means of DRYing up code in which I can’t (or don’t want to) use STI, but where I do have commonality between model classes. Worth a mention, I’d think?</p> <p>(Dave says: it’s in the version sitting on my hard drive. However, I still prefer using included modules over inheritance for this)</p> </td><td>2006-10-27</td><td></td></tr> <tr><td>148</td><td></td><td>OK</td><td><p>Havn’t actually tested this, but in the validate function, it seems hashed_password.blank? will never return true as the “wibble” salt will always be there.</p> <p>(Dave says: it will only be set if the password has been assigned to)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>332</td><td></td><td>OK</td><td><p>The very last line on the page suggests that “article.users << user” will create a row in the join table. I do not believe that is true. I believe that you would need:</p> <p>r = Reading.create<br /> article.users << r<br /> user.artlcles << r<br /> r.save</p> <p>I am using Rails version 1.1.6</p> <p>(Dave says: the book is written for Rails 1.2, where pushing to the association does indeed save the join table row)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>545</td><td></td><td>OK</td><td><p>the drag and drop examples do not work at all</p> <p>(Dave says: they seem to work OK here. Are you including the correct JavaScript libraries?)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>261</td><td></td><td>ERROR</td><td><p>We</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>406</td><td></td><td>TYPO</td><td><p>“But is also contains an extra<br /> hidden field named _method whose value is delete.”</p> <p>But it also contains</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>30</td><td></td><td>OK</td><td><p>In order for ‘rake rails:update’ to work, you seem to need the gems that the application originally used. ‘gem cleanup’ blows those away - so if the reader types in the commands in the order they are currently presented, the ‘rake rails:update’ command will fail. At least, it happened to me, after upgrading from rails-1.1.4. After using gem to reinstall rails-1.1.4, ‘rake rails:update’ seems to work.</p> <p>(Dave says: I don’t believe this to be the case. In fact, I’m not even sure that 1.1.4 had a rails:update rake target. Could someone else with 1,.1.4 confirm this, ideally by email?)</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>324</td><td></td><td>TYPO</td><td><p>"As with has_one, you can modify Active Record</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>123</td><td></td><td>OK</td><td><p>highlighting does not work when item is added for first time.<br /> using the .rjs code on page 123<br /> page[:current_item].visual_effect :highlight,<br /> :startcolor => “#88ff88”,<br /> :endcolor => “#114411”</p> <p>I get an error when i Add an item to the cart that was not yet in there.<br /> Firefox and Safari both display the new item in the cart but then a errorbox pops up stating :<br /> The page at http://localhost:3000/store<br /> RJS error:</p> <p>TypeError: $(“current_item”) has not properties.</p> <p>I worked around this ‘bug’ by adding an “IF” clause to the RJS.<br /> page[:current_item].visual_effect :highlight,<br /> :startcolor => “#88ff88”,<br /> :endcolor => “#114411” if @current_item</p> <p>(Dave says: does this fail if you download the code from our site? I’ve tried it here on all browsers with no problems. Also, I’m not sure how @current_item could even not have a value. I suspect you may have a different problem)</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>152</td><td></td><td>OK</td><td><p>Problem with code for index.rhtml template. Until I changed <% form_tag do <span style="text-align:right;">…<</span> end %> to <%= form_tag <span style="text-align:right;">…<</span>= end_form_tag %> the form was not being rendered. I am a ROR newbie so I could be missing something obvious.</p> <p>(Dave says: YOU NEED A RECENT VERSION OF EDGE RAILS)</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>433</td><td></td><td>TYPO</td><td><p>“look at the various Rails implementations in in directory” -> “look at the various Rails implementations in directory”, in footnote 5.</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>439</td><td></td><td>TYPO</td><td><p>“Rails supports three types of filter: before, after, and around.” -> “Rails supports three types of filters: before, after, and around.”</p> <p>(Dave says: wow! That was an ugly sentence. It now says:</p> <p>\t Here’s how this controller can use a filter to set the cart into<br /> \t the context of each action.</p> <p>)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>290</td><td></td><td>TYPO</td><td><p>In the Using Like Clauses section, 3rd paragraph, 2nd sentence:</p> <p>“As a result, it will go ahead <em>an</em> add<br /> extra quotes around the value of the name parameter.”</p> <p>an -> and</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>76</td><td></td><td>TYPO</td><td><p>in:<br /> depot> ruby script/generate migration add_test_data<br /> Exists db/migrate<br /> create db/migrate/003_add_test_data.rb</p> <p>2nd line “Exists” should not be capitalized.</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>109</td><td></td><td>SUGGEST</td><td><p>I found your first “playtime” here a tad misleading, as I took "You</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>246</td><td></td><td>TYPO</td><td><p>the 7-but ASCII character …<br /> should be<br /> the 7-bit ASCII character …</p> </td><td>2006-10-28</td><td></td></tr> <tr><td>32</td><td></td><td>ERROR</td><td><p>Edge Rails (assumed by the book) now uses Mongrel by default, not WEBrick</p> <p>(Dave says: if installed, yes. I’ve added it to the footnote)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>90</td><td></td><td>OK</td><td><p>In the 2nd ‘Playtime’ exercise, you encourage the reader to do exactly what you discourage on page 88 - namely, use the ‘link_to’ helper…</p> <p>(Dave says: I assume you’ll add a method=>:post to the call…)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>96</td><td></td><td>TYPO</td><td><p>Para 1: ‘observant readers’ comment made sense in 1st edition, but not in 2nd edition, where we added the button at the end of the last chapter.</p> <p>(Dave says: it still seems to make sense…)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>238</td><td></td><td>OK</td><td><p>Having installed subversion, I tried the two bits that were suggested and got the following:</p> <p>~> svn propset svn:externals “rails http://dev.rubyonrails.org/svn/rails/trunk” vendor<br /> subversion/libsvn_wc/lock.c:377: (apr_err=155007)<br /> svn: ‘.’ is not a working copy<br /> ~> svn up vendor<br /> Skipped ‘vendor’</p> <p>Either the directions are wrong or they’re missing key context for a new rails developer trying to install Edge rails on his machine.</p> <p>(Dave says: it previously says that you project itself must be stored in Subversion)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>118</td><td></td><td>OK</td><td><p>Hi Dave,<br /> From iterationD2 I am unable to see additions to cart unless I reload the page and even then it only shows the cart as an AJAX update without any effects. It seems that the effects.js does not work. I used the version with instant rails and then upgraded to using the latest version from Scriptaculous still not working. It seems to me that the fault is at the button add_to_cart. I am using EdgeRails v5370 and tried the program on my explorer and firefox with same result. Hope u can help. Thank you.</p> <p>(Dave says: It works fine for me here. Have you tried downloading the book’s source code and running that version?)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>115</td><td></td><td>OK</td><td><p>I get an exception from calling ‘redirect_to_index’ with no arguments. I changed it to ‘redirect_to_index(nil)’ to get around it…</p> <p>(Dave says: have a look at the first paragraph on the next page)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>22</td><td></td><td>SUGGEST</td><td><p>I have found a very good description of “Installing Ruby on Rails with Lighttpd and MySQL on Fedora” at http://digitalmediaminute.com/howto/fc4rails/<br /> This realy helped me out setup my rails on my linux.</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>48</td><td></td><td>TYPO</td><td><p>In the sentence “Use your browsers View -> Source […]”, “browsers” should be possessive.</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>579</td><td></td><td>TYPO</td><td><p>punctuation: full stop confusing; colon appropriate (?)</p> <p>services.</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>502</td><td></td><td>TYPO</td><td><p>In the paragraph titled “Passing Data to Layouts” the word “befoe” is wondering where its ‘r’ went.</p> <p>(Dave says: I have no idear)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>507</td><td></td><td>TYPO</td><td><p>omit ‘that’ (?):</p> <p>Here</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>45</td><td></td><td>ERROR</td><td><p>In the section of source code displayed in the middle of the page, the example code is missing the “>/body&lt;” tags before the “>/html&lt;” tags in the following places:</p> <p>The file hello.rhtml would contain<br /> the following.</p> <html> <p>….</p> <p> <p>Say <a href="/say/goodbye">Goodbye</a>!</p> </p> </html> <p>and the file goodbye.rhtml would point the other way.</p> <html> <p>….</p> <p> <p>Say <a href="/say/hello">Hello</a>!</p> </p> </html> </td><td>2006-10-30</td><td></td></tr> <tr><td>122</td><td></td><td>OK</td><td><p>I don’t know if this is a problem with the code or with Edge Rails but when I try and add the page[:current_item] code I get the error TypeError: $(“current_item”) has no properties.</p> <p>I get the same error when I copy over the code samples as well (eg the depot_r folder)</p> <p>Error occurs on Safari and Firefox 1.5</p> <p>(Dave says: I just tried it here, and the depot_m variant of the application seems to work without an problem in both Safari and Firefox. I get no reports of problems in the JavaScript console, and the cart updates as expected.</p> <p>The implication of the error is that there’s no id=“current_item” in your DOM at the time of the call. Is there a way you can verify this?)</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>663</td><td></td><td>ERROR</td><td><p>The layout for the admin interface here uses @content_for_layout, but the store layout uses the new yield :layout.</p> <p>(Dave says: oops - missed that one.)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>236</td><td></td><td>TYPO</td><td><p>in the second paragraph under the heading “what’s next” it says …“you need chapters 17 through 19/”</p> <p>my guess is that that “/” should be a “.”, no?</p> <p>(dave says: yes!)</p> </td><td>2006-10-30</td><td></td></tr> <tr><td>72</td><td></td><td>SUGGEST</td><td><p>You might want to center the image on this page, so that you are consistent with other images (previous page(71), 81, etc.)</p> <p>(Dave says: Good suggestion. We normally take care of this kind of thing during the layout phase)</p> </td><td>2006-10-31</td><td></td></tr> <tr><td>40</td><td></td><td>SUGGEST</td><td><p>It might be worth explaining the Rails 1.2 mechanisms for making user library code reloadable (e.g. Ruby modules under lib). It’s probably also worth noting that the old Rails 1.1 mechanism (include Reloadable) is deprecated.</p> <p>(Dave says: I don’t want to mentin Reloadable—that never really got documented, and it will generate a deprecation warning if used. I talk about more general loading issues when I go deeper into Rails after the depot example)</p> </td><td>2006-10-31</td><td></td></tr> <tr><td>420</td><td></td><td>SUGGEST</td><td><p>The context is the code block # DO NOT DO THIS. From what I can tell, the “gotcha” w.r.t. “render” also applies to “redirect_to”. Is this correct? If so, you might make that just a little clearer.</p> <p>(Davs says: yes, it does: I added</p> </td><td>2006-10-31</td><td></td></tr> <tr><td>522</td><td></td><td>TYPO</td><td><p>the second code snippet from the bottom reads</p> <p><%= javascript_include_tag “prototoype” %><br /> should be<br /> <%= javascript_include_tag “prototype” %></p> </td><td>2006-11-01</td><td></td></tr> <tr><td>xiii</td><td></td><td>TYPO</td><td><p>The preface has to be updated:</p> <p>It has been 16 months —> x months</p> <p>Dave Thomas<br /> May 2006 —> x 2006</p> <p>+ Short account of events since May?</p> </td><td>2006-11-01</td><td></td></tr> <tr><td>314</td><td></td><td>TYPO</td><td><p>The following code is not properly indented:</p> <p>def self.up<br /> create_table :products do |t|<br /> t.column :title, :string<br /> # …<br /> end <— ONE MORE TO THE LEFT (AND ALL FOLLOWING LINES)<br /> create_table :orders do |t|</p> </td><td>2006-11-01</td><td></td></tr> <tr><td>315</td><td></td><td>TYPO</td><td><p>add_index :categories_products, [:product_id, :category_id]<br /> add_index :categories_products, :category_id<br /> end <— MOVE ONE POSITION TO THE LEFT</p> </td><td>2006-11-01</td><td></td></tr> <tr><td>238</td><td></td><td>ERROR</td><td><p>Actually, it is a problem. Yes, my project isn’t in svn. Your write:</p> <p>(If you see an error saying that</p> </td><td>2006-11-01</td><td></td></tr> <tr><td>554</td><td></td><td>TYPO</td><td><p>What is an RJS template? … app/views HEIRARCHY (?)</p> </td><td>2006-11-01</td><td></td></tr> <tr><td>80</td><td></td><td>SUGGEST</td><td><p>I am not sure what version I have, although it is the newest one available.</p> <p>May I suggest steps on how to do a basic deployment to an live web server with re-deployment how-tos after each major Depot task? Your book is great at basic walk-throughs on how to build a site on one’s desktop with Ruby, but nobody seems to cover deployment. And what good is it laying around on my desktop. I paid $50 for the book expecting that sort of information. I had already found free tutorials that covered the basic desktop app.</p> <p>(Dave says: perhaps the deployment chapter… ??)</p> </td><td>2006-11-01</td><td></td></tr> <tr><td>112</td><td></td><td>OK</td><td><p>confirming existing comment about missing ‘end’ in cart.rb.</p> <p>page 111 ends with @items << CartItem.new(product)<br /> page 112 starts with two ‘end’ statements</p> <p>There needs to be three ‘end’ statements (to close the ‘if’, method, and class). The downloaded version of depot_g/app/models/cart.rb is correct and contains 3 ‘end’ statements.</p> <p>(Dave says: there’s no opening class to end: I’m just showing the individual method here)</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>41</td><td>28</td><td>SUGGEST</td><td><p>On p21 (PDF p.34), “As of OS X 10.4.6, Mac users have a decent Ruby installation included as standard.” Without explaining the deficiencies of earlier Tiger versions. Then on p. 28 (PDF p.41), it says “OS X ships with Ruby, but in Tiger this installation is not quite right.” To a reader unfamiliar with the issue, this must be very confusing, especially after reading on the earlier page that the Tiger’s installation is apparently okay.</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>78</td><td></td><td>SUGGEST</td><td><p>There is a slight inconsistentcy with the use of flash and yield in admin.rhtml. In previous sections of code you say that function X will be addressed later, but here you don’t. It makes the reader slightly uncomfortable in the fact that they might have missed something.</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>146</td><td></td><td>SUGGEST</td><td><p>In the description of the create_new_salt method, it would be useful to explain why the “self.salt” syntax is used instead of an instance variable syntax: “@salt” to assign the generated salt to the current User object. Or if these two are equivalent (and as a newbie I’m not clear on this yet), that would also be a good point to explain.</p> <p>(Dave says: one’s a method call to the accessor, which in turn sets the IV, the other sets it directly. It’s to some extent a question of style)</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>100</td><td></td><td>SUGGEST</td><td><p>Please, please, consider showing us the “preferred” way, that is database for the cart. If not here in the book then possibly in the source software or an appendix to the book. I suspect that many, like me, would learn even more from your excellent book.</p> <p>(Dave says: I wanted to show in-memory model objects, hence the current setup. I don’t think there’s anything new to learn from repeating the exercise with the cart in the database—it’s just another model in that case)</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>522</td><td></td><td>TYPO</td><td><p>The frame with condition_by_like: the actual code<br /> in rails2-code.tgz://<br /> code/pragforms/vendor/plugins/relevance_extensions/lib/active_record_extensions.rb<br /> is different from the code presented.</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>123</td><td></td><td>OK</td><td><p>I have the same problem<br /> Highlighting does not work when item is added for first time. using the .rjs code on page 123 page[:current_item].visual_effect :highlight, :startcolor => “#88ff88”, :endcolor => “#114411” I get an error when i Add an item to the cart that was not yet in there. I get the error in IE or Mozilla Firefox both display the new item in the cart but then a errorbox pops up stating : The page at http://localhost:3000/store RJS error: TypeError: $(“current_item”) has not properties.</p> <p>(Dave says: I cannot reproduce this, nor can anyone I’ve asked. My guess is that the add_product method in the cart model isn’t returning the current cart item in your version of the source.)</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>247</td><td></td><td>TYPO</td><td><p>2nd to last paragraph: "if you</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>270</td><td></td><td>SUGGEST</td><td><p>"You</p> </td><td>2006-11-02</td><td></td></tr> <tr><td>156</td><td></td><td>SUGGEST</td><td><p>It would be nice if, in an appendix, you explained how you could complete the playtime problems. I can’t do some of them, and it would really help my learnin’ if I could flip to the back for the solution, or at least some more hints.</p> <p>(Dave says: I’ve created a wiki for discussions of these exercises)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>463</td><td></td><td>TYPO</td><td><p>bottom of page 453: ’</p> </td><td>2006-11-03</td><td></td></tr> <tr><td>156</td><td></td><td>ERROR</td><td><p>I cannot get the notice div tag to hide. Everything else has worked fine for me so far. It very well could be me, but i’ve restarted the web server, triple checked the spelling and verified that the div tag does exist on the page when i view source.</p> <p>(Dave says: could you e-mail me, letting me know if you have the problem with the downloaded depot application from our site, and confirming the version of Rails you are running? Thanks [ dave at pragprog.com ]</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>Section 8.4</td><td></td><td>ERROR</td><td><p>According to the error message, this is probably to do with the fact that I’m using PostgreSQL instead of MYSQL.</p> <p>The error handling for “RecordNotFound” that the book gives has no effect because before it ever has to deal with not finding the record, it runs into the error that the SQL server is being handed a string when it’s expecting an integer:</p> <p>ActiveRecord::StatementInvalid<br /> PGError: ERROR: invalid input syntax for integer: “wibble”</p> <p>(Dave says: I’ve noted the need to adjust the error handling to the actual error you’re trying to handle)</p> </td><td>2006-11-04</td><td></td></tr> <tr><td>78</td><td></td><td>OK</td><td><p>In the sample code of list.rhtml you left out the loop<br /> “for column in Product”, which is in the code on page 76 - not vital but just a bit confusing as to where it would lie in relation to added code.</p> <p>(Dave says: that code is not needed inthe second version: the fields are displayed explicitly)</p> </td><td>2006-11-04</td><td></td></tr> <tr><td>418</td><td></td><td>TYPO</td><td><p>4th paragraph of the page, "We</p> </td><td>2006-11-05</td><td></td></tr> <tr><td>48</td><td></td><td>TYPO</td><td><p>In “Cleaning up”</p> <p>Fourth line: time we run it, because is willll<br /> Too many L’s</p> </td><td>2006-11-05</td><td></td></tr> <tr><td>19</td><td></td><td>OK</td><td><p>the link to page 225 - It’s going to pg 238, and the topic there is using edge rails. I can’t find how to INSTALL Edge Rails</p> <p>(Dave says: no—it goes to page 225—the PDF viewer is showing the absolute page offset, not the page numbers. The section it links to tells you how to add Edge Rails to your project—it’s all you need)</p> </td><td>2006-11-05</td><td></td></tr> <tr><td>475</td><td></td><td>SUGGEST</td><td><p>You write,</p> <p>People first using form_for are often tripped up by the fact that it should not be<br /> used in an ERb substitution block: you should write<br /> <% form_for :user, <code>account_holder do |form| %> and not <%= form_for :user, </code>account_holder do |form| %><br /> <sup></sup><br /> I had to read this about four times before catching the equals sign, and was in fact about to report an error because the two were identical. I’d suggest calling this out more loudly.</p> </td><td>2006-11-06</td><td></td></tr> <tr><td>117</td><td></td><td>OK</td><td><p>form_remote_tag doesn’t work for me using ‘do’ and ‘end’, the form and submit-button doesn’t show. If I change to <%= form_remote_tag … %> and end_form_tag instead of a block then it works. I’m not using edge-rails</p> <p>(Dave says: yuou’re right. It won’t work unless you use Edge Rails.)</p> </td><td>2006-11-06</td><td></td></tr> <tr><td>611</td><td></td><td>TYPO</td><td><p>“moments notice” should read “moment’s notice”</p> </td><td>2006-11-06</td><td></td></tr> <tr><td>160</td><td></td><td>TYPO</td><td><p>third paragraph, first line: “we’ve already seen on of these” should be “one” of these.</p> </td><td>2006-11-06</td><td></td></tr> <tr><td>128</td><td></td><td>TYPO</td><td><p>Not sure if i’m on the right page because others erratum do not refer to my page’s text but I clicked on report erratum in the PDF. I’m on playtime, chapter 9.6.<br /> There is a typo here “For example, can<br /> you set their initial state to hidden, and the*n* have them grow into place?”</p> </td><td>2006-11-06</td><td></td></tr> <tr><td>247</td><td></td><td>TYPO</td><td><p>Actual: ‘… if you enabling…’ Corrected: ‘… if you enable…’</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>250</td><td></td><td>TYPO</td><td><meta> <p>tag is not closed. it should be because the document doctype is XHTML</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>248</td><td></td><td>DEFER</td><td><p>you say “… the entire data path, from browser to database, agrees on a common encoding.”<br /> but there is no example with UTF-8 encoded column names.<br /> (possible with SQLite 3, for example)<br /> So the last (half)step on the path is missed.</p> <p>it would be nice to have the following migration<br /> in the ‘namelist’ example</p> <p>class RenameName < ActiveRecord::Migration<br /> def self.up<br /> rename_column :people, :name, ‘imię’<br /> end<br /> def self.down<br /> rename_column :people, ‘imię’, :name<br /> end<br /> end</p> <p>This breaks the index.rhtml code (page 250).<br /> I changed it to:</p> <p>… h(person[‘imię’]) … etc.<br /> … form.text_field :‘imię’ …</p> <p>Question: are there any chances to use<br /> person.imię in the future?</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>16</td><td></td><td>OK</td><td><p>I would replace the first statement in View Support with something like, “In Rails, the View is responsible for creating output for the user. This might be all or part of a page to be displayed in a browser, an XML response, an email, etc.”</p> <p>Comment: This is a great book!!!</p> <p>(Dave says: I think I’ll leave that in the footnote. Thanks!)</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>506</td><td></td><td>ERROR</td><td><p>In set_cart you refer to @session. I suspect that you just want session (not the instance variable)</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>335</td><td></td><td>TYPO</td><td><p>In the “Joe Asks…” box it says ‘shared amoung’ rather than ‘among’</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>349</td><td></td><td>SUGGEST</td><td><p>The suggested method for saving records, that would normally be automatically saved because of the has_one relationship:</p> <p>invoice = Invoice.new</p> <ol> <li>fill in the invoice<br /> invoice.save!<br /> an_order.invoice = invoice </li> </ol> <p>If I understand that correctly, this code results in two database writes. Another option might be to turn off the autosaving and just let the user handle the saving himself/herself. Is that possible in rails? If so this would be a great place to let the reader know.</p> <p>(Dave says: I don’t believe it’s possible to disable the save)</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>158</td><td></td><td>OK</td><td><p>“Would the Last Admin to Leave…” reads a bit funny. Maybe “Were the Last Admin to Leave…” is what is meant?</p> <p>(Dave says: the punch-line is “turn off the lights…”)</p> </td><td>2006-11-07</td><td></td></tr> <tr><td>26</td><td></td><td>SUGGEST</td><td><p>Perhaps mention of KDevelop as a development environment may be called for. The reason is that it’s a part of KDE and is available with the Fedora Core 6 release of Linux. It just works. Perhaps an appendix with all known editors with Rails support might be considered.</p> <p>(Dave says: that kind of thing would work better as a web site: it could be kept up to date as the world changed. In the book I’d rather focus on the current most popular tools)</p> </td><td>2006-11-08</td><td></td></tr> <tr><td>137</td><td></td><td>SUGGEST</td><td><p>Capturing Order Details<br /> Next, on line 5, we tell the order object to save itself (and its children, the line items) to the database (using a method we haven</p> </td><td>2006-11-08</td><td></td></tr> <tr><td>73</td><td></td><td>OK</td><td><p>When a principle has been taught, such as validation, perhaps a clue as to how the programmer might find reference to it in the Rails Framework Documentation.</p> <p>(Dave says: I’m not sure what to suggest: all I do is search for method names. Is there more I could offer?)</p> </td><td>2006-11-08</td><td></td></tr> <tr><td>271</td><td></td><td>OK</td><td><p>In the context below should it not say “drop and recreate the table” instead of “drop and recreate the database”??</p> <p>Alternatively, some teams don</p> </td><td>2006-11-08</td><td></td></tr> <tr><td>24</td><td></td><td>SUGGEST</td><td><p>I realize the book is in very late development, but I just wanted to mention that I think the Rails.vim project deserves mention in your editors section. I know everyone and his uncle wants FooEd listed, but Vim being easily the second (or first, depending on your religious bent :) most popular programmers editor ever, a nice Rails integration like this deserves to get its 5 minutes of fame.</p> <p>http://rails.vim.tpope.net/</p> <p>Note that I have no emotional investment in this, I regularly use TextMate but my powerbook is in the shop for a week (Augh!) and I’m trapped on other platforms like Windows and Linux for the nonce. Thanks for the awesome book and thanks for your time!</p> <p>-Chris</p> <p>(Dave says: I’ll have to respond the same to this as I did to the kdevelop comment: the area’s just too volatile to include in a book)</p> </td><td>2006-11-08</td><td></td></tr> <tr><td>81</td><td></td><td>TYPO</td><td><p>The line:<br /> • The method validates_length_of (described on page 359) checks the length<br /> links to page 356. Page 359 is the correct page.</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>557</td><td></td><td>ERROR</td><td><p>The code before ‘Selecting Elements’ section illustrates<br /> the ‘remove’ function.<br /> I think the line :<br /> page.delete “todo_#{params[:id]}”<br /> should be :<br /> page.remove “todo_#{params[:id]}”</p> <p>(Dave says: good catch)</p> </td><td>2006-11-09</td><td></td></tr> <tr><td>57</td><td></td><td>OK</td><td><p>In bullet point one, there is an open parenthesis but no closing parenthesis.</p> <p>(Dave says: I can’t find this. Any chance you could e-mail the sentence containing the problem? Thanks)</p> </td><td>2006-11-09</td><td></td></tr> <tr><td>58</td><td></td><td>OK</td><td><p>On Windows, a password is required for root during the installation process. Even when I tried to reconfigure MySQL to use now password, it still required one. Maybe one of the command line tools would allow for no password, but the default setup requires one. So, at least for Windows users, it seems they will need to configure the password in the database.yml file even for the root user.</p> <p>(Dave says: I tried it here using a fresh install of InstantRails and it worked with no password)</p> </td><td>2006-11-09</td><td></td></tr> <tr><td></td><td>283</td><td>ERROR</td><td><p>You list the PostgreSQL adaptor as being:<br /> adapter: “postgres”</p> <p>However, that doesn’t appear to work. I have been using:<br /> adaptor: postgresql</p> <p>This is a little odd, because in my non-rails code I use:<br /> require ‘postgres’ for the same library. I am using the snapshot of the postgres library found on rubyforge</p> <p>(Dave says: you’re right—it should be postgresql in the :adapter line)</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>133</td><td></td><td>OK</td><td><p>On this page, you promised</p> <p>"Finding the cart at the start of each action is starting to get tedious; we</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>125</td><td></td><td>SUGGEST</td><td><p>why not write the hidden_div_if-function the same way as form-helpers. ie. with block instead so you call<br /> <% hidden_div_if … do <span style="text-align:right;">[the cart]<</span> end %></p> <p>(Dave says: that’s a perfectly reasonable approach)</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>517</td><td></td><td>TYPO</td><td><p>The fram on the top: According to the W3C HTML 4.0.1<br /> Specification<br /> There is no HTML 4.0.1 Specification, but there is 4.01 one. See http://www.w3.org/TR/html4/</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>515</td><td></td><td>SUGGEST</td><td><p>Please add the footnote from the 1st edition somwhere near `modiyfing the address bar’:</p> <p>For security reasons you can safely call<br /> URLs only on the same server/port as the page<br /> that includes the call to XMLHttpRequest.</p> <p>(Dave says: in this new chapter, this is now implicit, as we’re using higher-level calls)</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>266</td><td></td><td>SUGGEST</td><td><p>You should flash a warning on the page that migration LoadUserData is destructive up and down. Someone I’m working with had copied that into a new migration and I nearly lost a lot of development data. Fortunately I looked at his code before running rake migrate.</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>96</td><td></td><td>TYPO</td><td><p>Note this line in the 2nd para: "…Let</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>224</td><td></td><td>TYPO</td><td><p>In note 3 at the bottom of the page, the last line is “and edge version of Rails, instead.” The word “and” s/b “an”.</p> </td><td>2006-11-10</td><td></td></tr> <tr><td>114</td><td></td><td>OK</td><td><p>a</p> </div> <p>that shouldn’t be there in _cart.rhtml in: depot_m, n and o.</p> <p>(Dave says: I believe it’s OK: the</p> </div> <p>above</p> <div id="main"> <p>closes the opening</p> <div id="side"> </td><td>2006-11-10</td><td></td></tr> <tr><td>2</td><td></td><td>SUGGEST</td><td><p>You are requiring Rails 1.2 specific features for the book. It would be nice if you explained or listed what these are…</p> <p>(Dave says: it’s pretty pervasive.</p> <p>I thought long and hard about this. I really wanted to write a book that was free-standing. Two months from now, no one will care about 1.1—Rails 1.2 will be the version everyone uses. I didn’t want to spend a lot of time in the book looking back simply because the book happens to come out on the cusp.</p> <p>For a detailed look at the changes, there’s always the Changelog. And I know the core team are planning release notes that will list all the significant new and changed features.)</p> </td><td>2006-11-11</td><td></td></tr> <tr><td>251</td><td></td><td>TYPO</td><td><p>Must be “inside every Rails database.” instead “inside every Rails database,.” (look at the comma).</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>154</td><td></td><td>OK</td><td><p>should<br /> before_filter :authorize, :except => :login<br /> be<br /> before_filter :authorize, :except => “login”<br /> ?</p> <p>(Dave says: both work, I believe)</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>534</td><td></td><td>SUGGEST</td><td><p>endpoint (called auto_complete_for_usr_language —</p> <p>I don’t understand that: endpoint means a method<br /> or a div with that id or something different.<br /> There is at least on place in the book where<br /> `endpoint’ is used.</p> <p>(Dave says: Justin uses it to mean a service endpoint)</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>538</td><td></td><td>TYPO</td><td><p>Look at that JavaScript snippet:<br /> "‘todo=’ = encode…</p> <p>this is a string containing ‘todo=’ and<br /> JavaScript snippet.<br /> The `todo’ is used to generate element<br /> todo_[database id] ? Am I right?</p> <p>I think that every occurence todo_[database id]<br /> should be replaced with todo_<change to italic font><br /> database id</change></p> <p>(Dave says: the notation was ambiguous. it should be todo_<emph>databaseid</emph>)</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>539</td><td></td><td>TYPO</td><td><p>After // should be <![CDATA[ / ]]></p> </td><td>2006-11-13</td><td></td></tr> <tr><td>243</td><td></td><td>TYPO</td><td><p>“one of more 16- or 8-bit values” should read “one or more 16- or 8-bit values” (replace “of” with “or”).<br /> Also “When Rails store strings in Unicode” should read “When Rails stores strings in Unicode” (“stores” not “store”).</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>220</td><td></td><td>TYPO</td><td><p>Half way down the page, there is a description of the ‘benchmarker’. The description has a typo:<br /> ‘nmber’ is in the page, but should be ‘number’.</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>397</td><td></td><td>OK</td><td><p>“Construct a new resource, and pass it to the client. This resource will<br /> not have been saved on the server.” From a REST perspective, I don’t think this makes sense - no new resource is created (although there’s a call to XXX.new on the server side). The resource is already there, its representation is the empty form. The new REST resource will only be created once the user submits the form.</p> <p>(Dave says: I agree—Rails bends REST to make the user interface side work. But, I do believe that there’s a resource involved, if only a transient one)</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>403</td><td></td><td>TYPO</td><td><p>/article/1;embargo should be /articles/1;embargo ; the same is true for /article/1;release and /article/new;shortform on p. 404</p> <p>(Dave says: good catch)</p> </td><td>2006-11-12</td><td></td></tr> <tr><td>148</td><td></td><td>OK</td><td><p>The parenthetical note “Note that we…” starting on the very last line states that we added an admin layout to the new Login controller, but there is no mention of ‘admin’ or ‘layout’ in the script/generate output farther up the page. Seems like either a typo or a non-obvious side effect.</p> <p>(Dave says: we added the layout to the controller: look at the second line of the controller source)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>433</td><td></td><td>ERROR</td><td><p>I’m no expert, but according to <http://glu.ttono.us/articles/2006/08/30/guide-things-you-shouldnt-be-doing-in-rails>, the usage of “@flash” has been deprecated. They recommend using “flash” instead.</p> <p>(Dave says: good catch)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>225</td><td></td><td>SUGGEST</td><td><p>You have a link from the beginning of depot that uses edge rails. And in your note there, you said the guide should teach to “install it”<br /> Maybe add “svn co http://dev.rubyonrails.org/svn/rails/trunk vendor/rails<br /> ”</p> <p>(Dave says: I feel that an svn:external approach is preferable to a checkout. If you’re going to checkout, then an export is probably better still, using the rake tasks)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>2</td><td></td><td>SUGGEST</td><td><p>I am using Locomotive 2.0.8 on an Intel Mac w/2G memory. I unzipped rail.zip into ~/depot/vendor. Did rake rails:update which appeared to do its thing, but rails -v still shows “Rails 1.1.6” and the rake db:migrate on page 80 still breaks with a parse error. There is some mystery (to me anyway) about what is happening in Locomotive, and I’m still very much a newby in Ruby, so any Locomotive-specific help installing your temporary 1.2 codebase would be appreciated. I had no luck at all with running on the Edge, although I got an svn client working and tested, so I presume that the same problem that prevented the Edge 1.2 installation from working under Locomotive is preventing your codebase installation from working. I’m about ready to do my own installation from scratch, just so I can keep working through the book.</p> <p>(Dave says: did you run under the Locomotive console, rather than a general one? [To be honest, this kind of issue is why I gently suggest folks not use locomotive in the book)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>222</td><td></td><td>TYPO</td><td><p>before superscript 3:</p> <p>is store in a remote repository.</p> <p>stored seems like the proper tense</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>98</td><td></td><td>OK</td><td><p>in the modifications to the view, the book says the list item should have the following code:</p> <li> <p><%= cart_item.quantity %> × <%= h(cart_item.title) %></p> </li> <p>However, when you runt he code like this, you get “undefined method `title’ for #<CartItem:0x2b30422c2a18>”. The title tag needs to reference the specific title, like this: <%= h(cart_item.product.title) %></p> <p>(Dave says: please try again using the downloaded version of the code. (You forgot to add the title accessor to class cart_item on the previous page, or you’re not running Edge Rails, and therefore you need to stop and restart your application for changes to take effect)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>100</td><td></td><td>TYPO</td><td><p>In footnote 6, the first word of the second sentence is spelled “Oher” — It should be “Other”</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>160</td><td></td><td>ERROR</td><td><p>There is a (very) small chance that A and B will still be able to delete each other at the same time with the given solution (unless your transaction isolation is serializeable)</p> <p>A destroys<br /> B destroys<br /> A counts (1)<br /> B counts (1)<br /> A commits<br /> B commits</p> <p>perhaps worth a mention?</p> <p>not sure how you do better in this case though.. DB constraint?</p> <p>(Dave says: damn, I could have sworn I’d tested this at the console, but you’re right.)</p> </td><td>2006-11-13</td><td></td></tr> <tr><td>403</td><td></td><td>TYPO</td><td><p>In the 4th paragraph when it says: “option to tell url_form” it should be “option to tell url_for”</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>621</td><td></td><td>TYPO</td><td><p>this line:<br /> $ sudo port install mysql5 + server<br /> should be:<br /> $ sudo port install mysql5 +server</p> <p>as in… no space between the plus and “server”</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>398</td><td></td><td>ERROR</td><td><p>When you use script/generate scaffold_resource, you mention that the generator reminds us to put the map.resources line into routes.rb. I just ran this generator with revision 5448 of Rails and the line is put into routes.rb automatically.</p> <p>(Dave says:so much for freezing the features in the 1.2 branch….)</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>113</td><td></td><td>OK</td><td><p>Footnote 6 states that PostgreSQL will raise a StatementInvalid exception instead. I believe this particular RecordNotFound exception is independent of the database engine as using PostgreSQL as the back-end results in the same RecordNotFound exception.</p> <p>(Dave says: I;ve had reports from other readers that a different exception is thrown if you use a string which isn’t parsable as a number)</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>636</td><td></td><td>TYPO</td><td><p>Missing apostrophe. “sharing the modules functionality” should be “sharing the module’s functionality”.</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>543</td><td></td><td>ERROR</td><td><p>The line {:external_control => “edit_#{column.name}” %> is missing a }. It should be:<br /> {:external_control => “edit_#{column.name}”} %></p> </td><td>2006-11-14</td><td></td></tr> <tr><td>90</td><td></td><td>SUGGEST</td><td><p>Being of the the “less robust” student… I am sitting here wondering what is the answer. Maybe simply attach a little answer key. (I am sitting here doing exercise 2, and I am almost in tears now)</p> <p>(Dave says: there’ll be a wiki with hints available in a day or two)</p> </td><td>2006-11-14</td><td></td></tr> <tr><td>171</td><td></td><td>SUGGEST</td><td><p>After explaining the after_destroy hook, it would be nice to see a code snipped of the complete controller method delete_user, with exception handling included. The previous code snippet for delete_user a couple pages prior does not have exception handling.</p> <p>(Dave says: Good news: the code is in the appendix. Bad news: we’ve gone to the printers, so those kinds of changes are unlikely to appen inline…)</p> </td><td>2006-11-15</td><td></td></tr> <tr><td>80</td><td></td><td>OK</td><td><p>I added the following to 002_add_price.rb:</p> <p>class AddPrice < ActiveRecord::Migration<br /> def self.up<br /> add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0<br /> end<br /> def self.down<br /> remove_column :products, :price<br /> end<br /> end</p> <p>And then ran the rake db:migrate command. The error I got back was as follows.</p> <p>(in C:/temp/InstantRails/rails_apps/depot)<br /> AddPrice: migrating ==<br /> — add_column(:products, :price, :decimal, {:precision=>8, :scale=>2, :default=><br /> 0})<br /> rake aborted!<br /> You have a nil object when you didn’t expect it!<br /> You might have expected an instance of Array.<br /> The error occured while evaluating nil.[]</p> <p>(See full trace by running task with —trace)</p> <p>Perhaps this is because I am running an earlier version of Rails. I downloaded InstantRails as per your instructions. It may be best to clarify that these statements may only work on vX.X of Rails, or whatever is necessary.</p> <p>(Dave says: the very first page of the book explains that you need to run Rails 1.2, and gives instructions on how to get it while we’re waiting for the core team to produce it)</p> </td><td>2006-11-16</td><td></td></tr> <tr><td>80</td><td></td><td>TYPO</td><td><p>(in /Users/dave/Work/BS2/titles/RAILS2/Book/code/depot_a)</p> <p>should be</p> <p>(in /Users/dave/work/depot)</p> <p>from page 75</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>86</td><td></td><td>TYPO</td><td><p>The options for overwriting the files are listed as Ynaq in the pdf, but the script actually has Ynaqd as the options — no big deal but thought you might want to make a correction next time you’re modifying things</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>147</td><td></td><td>OK</td><td><p>I have a large monitor, but even when I view the page full screen, with the full PDF page height hsown, the ‘=’ character looks like a ‘<del>’. So, I see “PAYMENT_TYPES - [ …”. Of course, once I realized this, I was fine</del> but it creates confusion for the newbie. First thought is “That’s weird syntax! What does it mean?” I suggest you change the font/size for the ’=’ chracters on ALL pages. Thanks.</p> <p>(Dave says: I have a couple of 23" monitors, and I don’t see this. Could you email me a screenshot independently: dave@pragprog.com)</p> </td><td>2006-11-16</td><td></td></tr> <tr><td>19</td><td></td><td>TYPO</td><td><p>“that” should be “than” in the 3rd paragraph in section 1.3: “The vast majority ended up being incorporated, making<br /> this book immeasurably more useful that it would have been.”</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>277</td><td></td><td>SUGGEST</td><td><p>Third paragraph, second sentence: “If you need composite primary keys to make Rails work with a legacy schema, google for some plugins.” Google’s trademark lawyers will not take kindly to this usage. Try “…search Google…” or “…consult your favorite search engine…”</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>386</td><td></td><td>ERROR</td><td><p>The 6th through 8th call to rs.recognize_path in the console route to :action=>“unknown_request”, which appears to be wrong, given that the routing on the previous page connects the typical “blog/:controller/:action/:id”.</p> <p>(Dave says: the use_controllers line at the top should include “article”)</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>231</td><td></td><td>TYPO</td><td><p>last para, 2nd sentence should scripts/console be script/console</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>218</td><td></td><td>TYPO</td><td><p>The link to page 676 (full listing of the minilanguage version of the testing class) should point to page 673 instead.</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>218</td><td></td><td>DEFER</td><td><p>The Integration Testing Support section opens with a description of the session object and a list of its attributes. It would be more instructive if the example tests actually made use of one or more of these attributes. See them used in context would help the reader to grok their usefulness.</p> </td><td></td><td></td></tr> <tr><td>225</td><td></td><td>TYPO</td><td><p>Last sentence of 2nd-to-last paragraph: “the collect simply returns…” should read “the collect method simply returns…”</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>225</td><td></td><td>TYPO</td><td><p>In the very first line: “cart.total_price” should be “@cart.total_price”</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>238</td><td></td><td>TYPO</td><td><p>Second to last paragraph: “you can create multiple of environments” -> “you can create multiple environments”</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>700</td><td></td><td>DEFER</td><td><p>“Legacy schema: see Database” in Index. This deserves a unified discussion of basic issues like set_primary_key, set_table_name, AR:Base.pluralize_table_names, capitalized column names, composite keys. Also note a decent # wiki pages (google “site:wiki.rubyonrails.com legacy” and examples e.g. http://www.bigbold.com/snippets/posts/show/1314. Most importantly, mention that it’s <strong>not</strong> that hard!</p> </td><td></td><td></td></tr> <tr><td>304</td><td></td><td>TYPO</td><td><p>Near the bottom of the page, in the 2nd sentence under “Writing Your Own SQL”; “The method find_by_sql lets your application to take full control.” probably should read “The method find_by_sql lets your application take full control.”; removing the word “to”.</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>495</td><td></td><td>TYPO</td><td><p>The text_area method, defined towards the bottom of the page, is claimed to be identical to the text_field method defined above. The code does have the same result, but text_field uses @template.tag for specifying <br>, where text_area just specifies the string “<br/>”.</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>115</td><td></td><td>OK</td><td><p>The first paragraph reads "our application has moved on</p> </td><td>2006-11-21</td><td></td></tr> <tr><td>78</td><td></td><td>TYPO</td><td><p>“the model examined the the database table,”</p> <p>two “the”s</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>641</td><td></td><td>TYPO</td><td><p>scripts/console should be script/console</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>34</td><td></td><td>ERROR</td><td><p>Locomotive runs the mongrel webserver now.</p> <p>“Beginning with these Sept 2006 bundle, mongrel is now the default server in Locomotive. Lighttpd is still included and can be configured for use by adding ”server: lighttpd" to your config/locomotive.yml file."<br /> http://locomotive.raaum.org/bundles/index.html</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>138</td><td></td><td>TYPO</td><td><p>At the end of the fourth line of the paragraph after the bullet points, there is a phrase “if your application stop working” which should be “if your application stops working”.</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>95</td><td></td><td>OK</td><td><p>The download to store_controller.rb contains a def, add_to_cart, that hasn’t been discussed yet (unless I err). It’s obvious what it does, but I wonder if some mention of it is called for in the text.</p> <p>(Dave says: the method doesn’t appear in the text yet, so I won’t mention it. The downloads are never behind the text, but sometimes foreshadow it… )</p> </td><td>2006-11-21</td><td></td></tr> <tr><td>626</td><td></td><td>ERROR</td><td><p>A line in the section on regexes reads:</p> <p>This bar character means</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>23</td><td></td><td>SUGGEST</td><td><p>Add praise quote</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>294</td><td></td><td>ERROR</td><td><p>In the penultimate paragraph you say: “This code returns an array of arrays.” I think that’s wrong. It looks like an array of an array but at least #count returns an OrderedHash, not an array of arrays. That’s very confusing since they are represented the same way in the console. You can use .to_a to convert the OrderedHash to an array of arrays.</p> <p>(Dave says: good catch: I didn’t know that)</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>182</td><td></td><td>TYPO</td><td><p>True path revealed in rake stats output</p> </td><td>2006-11-22</td><td></td></tr> <tr><td>411</td><td>410</td><td>TYPO</td><td><p>Bottom paragraph, “rourtes” should be “routes”.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>499</td><td></td><td>OK</td><td><p>Don’t you need a submit tag to get the calculator to work?<br /> <%= submit_tag “Calculate” %></p> <p>Mine doesn’t seem to work otherwise (in FF2)</p> <p>(Dave says: works here.)</p> </td><td>2006-11-23</td><td></td></tr> <tr><td>502</td><td></td><td>DEFER</td><td><p>there is a problem with the example of creating a data column in the migration to create a file upload table<br /> t.column :data, :binary, :limit => 1.megabyte</p> <p>this just works for mysql. there should be a hint or comment, what to write for other database-types, such as postgres, where you just leave out the :limit</p> </td><td>2006-11-23</td><td></td></tr> <tr><td>1</td><td></td><td>DEFER</td><td><p>i would suggest to dedicate some pages to postgresql, which is by the way a fully SQL99 compliant database system (which mysql isnt.) — postgresql and sqlite are both SQL-standard compatible. furthermore it might be worth mentioning to use features such as SEQUENCES in postgresql via default_sequence_name() and the other specific things in ActiveRecord::ConnectionAdapters::PostgreSQLAdapter \t<br /> In: vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb</p> </td><td></td><td></td></tr> <tr><td>292</td><td>290</td><td>ERROR</td><td><p>You have it listed to install an Openbase Adapter to use: gem install openbase. This does not work, as it says it is not in the repository…</p> <p>(Dave says: install from http://ruby-openbase.rubyforge.org/)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>77</td><td></td><td>OK</td><td><p>When running the depot application for the first time, you discuss WEBrick initial output and a little on WEBrick itself. As far as I can tell, Rails 1.2 RC1 uses Mongrel.</p> <p>(Dave says: if you have it (or lighttpd) installed, it uses them. Webrick is the fallback)</p> </td><td>2006-11-24</td><td></td></tr> <tr><td>74</td><td></td><td>OK</td><td><p>This text is found on page 74:</p> <p>…name is the plural form of the model</p> </td><td>2006-11-25</td><td></td></tr> <tr><td>119</td><td></td><td>OK</td><td><p>Possibly not your error - but it’s mine. I’m using SQLServer 2005 for the db. Passing your “wibble,” which is not a bigint causes SQLServer to be unhappy since it wants only integers, not a varchar as reported. I would guess I would need to pre-error check to see if an integer was being passed.</p> <p>DBI::DatabaseError: Execute<br /> OLE error code:80040E07 in Microsoft OLE DB Provider for SQL Server<br /> Error converting data type varchar to bigint.<br /> HRESULT error code:0x80020009<br /> Exception occurred.: SELECT TOP 1 * FROM products WHERE (products.id = ‘wibble’)</p> <p>(Dave says: indeed: I believe I say that you’ll get different exceptions with different databases)</p> </td><td>2006-11-25</td><td></td></tr> <tr><td>289</td><td></td><td>OK</td><td><p>on the bottom of the page, “title” => “My Great American Novel”} isn’t green like the rest, it is still blue.</p> <p>(Dave says: out code formatter isn’t too clever… Sorry)</p> </td><td>2006-11-25</td><td></td></tr> <tr><td>109</td><td></td><td>OK</td><td><p>Playtime problem again. I fussed with that counter until I got totally frustrated, thinking that I may have put the count test/increment in the wrong place or something. As long as you’ve decided to omit the solutions to these exercises from the book, could they be on a site somewhere or could there be a reminder that there is a Rails mailing list in a footnote? I still need to find the solution. (If I were a “regular” on the list, I might find it frustrating to see the same question reappearing in the list as the book gained more readership, which I hope it does, for it’s a great book.)</p> <p>(Dave says: there’s a link at the end of each one to a wiki where solutions are discussed)</p> </td><td>2006-11-25</td><td></td></tr> <tr><td>518</td><td>518</td><td>TYPO</td><td><p>In the “Fragment Cache Storage Options” section, you reference the “Deployment and Scaling” chapter, which does’t appear to exist in the book any longer, probably because you split out the relevant scaling sections into other chapters — hence the link backwards to “Picking a Caching Store Strategy” in “Action Controller and Rails.”</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>157</td><td></td><td>DEFER</td><td><p>A paragraph towards the middle of the page contains the text</p> <p><i>It doesn</p> </td><td>2006-11-26</td><td></td></tr> <tr><td>347</td><td>345</td><td>TYPO</td><td><p>under “joe asks”, 2nd sentence.. “But what it you want..” should read “But what if you want”..</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>100</td><td></td><td>ERROR</td><td><p>Footnote 6 says: “If you use PostgreSQL, for example, it will refuse to accept wibble as a valid value for the primary key column and raise a StatementInvalid exception instead.”<br /> Using PostgreSQL I got “RecordNotFound”.</p> <p>(Dave says: strangely, this footnote was added because a Postgres user reported the StatementInvalid error. The principle stands, even if different versions of the Postgres adaptor seem to raise different errors.)</p> </td><td>2006-11-27</td><td></td></tr> <tr><td>42</td><td>32</td><td>TYPO</td><td><p>p42; in the middle of section 3.7 “(We have more to say about updating your application in production in the Deployment and Scaling chapter, starting on page 613.)”; “Deployment and Scaling” looks like it should be the chapter title, which currently is “Deployment and Production”, or, the Chapter 27 title should be changed to Deployment and Scaling (?). (See typo for PDF p518 as well.)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>487</td><td></td><td>OK</td><td><p>Perhaps it’s hard to tell because the controller and model code are not referenced, but using this:</p> <p><% form_for :user do |form| %></p> <p><%=<br /> <code>users = User.find(:all, :order => "name") form.collection_select(:name, </code>users, :id, :name)<br /> %></p> <p>Seems to say that you want to set the <strong>name</strong> field for a new or existing user instance to the <strong>id</strong> (probably primary key) of an <strong>existing</strong> user instance whose <strong>name</strong> attribute you select from the resulting dropdown.</p> <p>From the surrounding text, it sounds like you are advocating this for an instance when you have a lookup table such that:</p> <p>class User < ActiveRecord::Base<br /> belongs_to :department<br /> end</p> <p>class Department < ActiveRecord::Base<br /> has_many :users<br /> validates_presence_of :name<br /> end</p> <p><% form_for :user do |form| %></p> <p><%=<br /> <code>departments = Department.find(:all, :order => "name") form.collection_select(:department, </code>departments, :id, :name)<br /> %></p> <p>However, this would fail on submission because the :id corresponds to the column :department_id in the users table implied by the relationship, not :department as the above states, so you would have to write this:</p> <p><%=<br /> <code>departments = Department.find(:all, :order => "name") form.collection_select(:department_id, </code>departments, :id, :name)<br /> %></p> <p>Tested against the Rails code bundle referenced by the latest book version.</p> <p>(Dave says: I think you’re reading too much into the code snippet: I’m just showing a way of selecting from a collection. The first name attribute could probably be better named, though… P:)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>123</td><td></td><td>OK</td><td><p>I’d like to be able to add notes in my copy of the book, which is the PDF version. Some PDF readers allow for the reader to enter form data. Could some empty form boxes be included at strategic places?</p> <p>(Dave says: most PDF readers allow annotations directly)</p> </td><td>2006-11-27</td><td></td></tr> <tr><td>553</td><td>553</td><td>TYPO</td><td><p>in “If your DOM is is formatted as priority_todo_database id, then the serializer<br /> will send ”priority_todos“=>[”todo_359“, ”todo_421“] to the server.” the 2nd “is” after DOM should be deleted.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>499</td><td>499</td><td>ERROR</td><td><p>Use of <code>params is deprecated in the latest rails edge. I got the following message from the mongrel: DEPRECATION WARNING: </code>params is deprecated! Call params.[] instead of @params.[]. Args: [:arg1] See http://www.rubyonrails.org/deprecation for details.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>500</td><td>500</td><td>ERROR</td><td><p>two errors which survived since the first edition:<br /> <code>result = Float(params[:arg1]).send(params[:op], params[:arg2]) should be: </code>result = Float(params[:arg1]).send(params[:operator], Float(params[:arg2]))</p> <p>After these changes, the form_tag from the previous page still does not work. It needs the submit_tag(“calculate”).<br /> Otherwise the params array is not updated? with :arg1, :arg2, :operator</p> <p>(Dave says: I don’t think a submit tag is needed—works fine here without)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>394</td><td>393</td><td>TYPO</td><td><p>"#<Actioncontrollera::Routing</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>508</td><td>508</td><td>ERROR</td><td><p>In the example at the top of the page the layout example uses<%= @content_for_layout %> when previous examples were using the preferred <%= yield :layout %>.</p> <p>Is this on purpose or a consistensy error?</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>89</td><td>79</td><td>ERROR</td><td><p>The AddTestData migration assumes that the database is empty, but if a reader is following along with the tutorial, he/she would have added an entry for Pragmatic Version Control back on PDF page 77. Since we enforce title uniqueness in Iteration A3, the AddTestData migration does not add the “correct” (formatted and with price) version of this item. I would suggest doing a Product.delete_all as the first step of self.up in this migration, to make sure we are starting from a known point.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>171</td><td>163</td><td>TYPO</td><td><p>Fixing this would require more database wizardry <strong>that</strong> we have space for here</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>80</td><td></td><td>OK</td><td><p>updated rails and still get the nil object error reported above.</p> <p>(Dave says: Have you tried it with code downloaded from the book’s site?)</p> </td><td>2006-12-06</td><td></td></tr> <tr><td>418</td><td></td><td>SUGGEST</td><td><p>In the discussion of RESTful application development, is there any reason that xxx_url methods are used in favor of xxx_path methods in the example tables? It seems confusing that the resource scaffold favors xxx_path methods but the book highlights the former. I realize that both are created for resources but it might be less confusing to be consistent with the framework.</p> </td><td>2006-12-06</td><td></td></tr> <tr><td>15</td><td>2 </td><td>TYPO</td><td><p>Second sentence of the last paragraph on the page: “Rails is new, and the core team of developers understand the new Web.” “Understand” should be plural as it refers to the “core team” rather than “of developers.”</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>89</td><td></td><td>OK</td><td><p>When I run rake db:migrate as on Page 89 while working through the book, I get the error: “Expected Object is not missing constant Product!”</p> <p>Note: I’m running InstantRails (rails -v gives Rails 1.1.6) with the provided update as mentioned on Page 2 of the PDF book.</p> <p>(Dave says: could you try it with code downloaded from the book’s site? I’ve never seen that problem here.)</p> </td><td>2006-12-06</td><td></td></tr> <tr><td>all</td><td></td><td>OK</td><td><p>In my Panther’s Preview, the command to write won’t appear in the PDF.<br /> I tried to read in an Acrobat 6.0 in Windows, and it’s working.<br /> Here’s an image of it: http://www.caraguanet.com.br/arthur/Book.jpg</p> <p>(Dave says: try rebooting: preview’s PDF support is very, very buggy)</p> </td><td>2006-12-06</td><td></td></tr> <tr><td>301</td><td>299</td><td>TYPO</td><td><p>“With no extra parameters, the finder effectively executes a select from… state-<br /> ment. The :all form returns all rows from the table, and :first returns one.”</p> <p>The inline code mention “select from…” should read “select * from…”</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>678</td><td></td><td>OK</td><td><p>css comments do not start with a pound sign. This is broken and does not work, I lost a good bit of time figuring it out, led down the path by the typical pound-is-comment assumption.</p> <p>Broken:<br /> #product-list .list-title {<br /> color: #244;<br /> font-weight: bold;<br /> font-size: larger;<br /> }</p> <p>This would work:<br /> /*product-list */ .list-title {<br /> color: #244;<br /> font-weight: bold;<br /> font-size: larger;<br /> }</p> <p>(Dave says: it isn’t a comment. It’s a selector)</p> </td><td>2006-12-07</td><td></td></tr> <tr><td>102</td><td>93</td><td>TYPO</td><td><p>The last Playtime bullet-point of chapter 7 is introduced as follows:</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>409</td><td>408</td><td>ERROR</td><td><p>2nd Paragraph, 4th Sentence… I believe it should read “URL /articles/1” NOT “URL /article/1”</p> <p>Also, 4th Paragraph, 2nd Sentence… similarly “/article/1” should be “/articles/1”</p> <p>And also, 5th Paragraph, last sentence… “/users, /users/1,…” rather than “/users, /user/1,…”</p> <p>If I am wrong about this, then I suspect you’ve got it wrong on the next page (but I believe the next page is correct)… either way it needs to be consistent.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>171</td><td></td><td>DEFER</td><td><p>If session[:original_uri] is the ‘logout’ page,<br /> then clicking login will redirect you to logout<br /> …and back to login again :)</p> <p>I suggest the following…<br /> Using flash.now[:notice] = “Logged out” in the logout method.<br /> And excluding the logout method in the filter:<br /> before_filter :authorize, :except => [ :login, :logout ]</p> <p>(Dave says: this will only occur if the user enters the URL manually. I agree it could be better, but I can’t repaginate the book at this point)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>all</td><td></td><td>SUGGEST</td><td><p>In the PDF, the ‘report errata’ links are a nice way<br /> to check for changes. However, once you’re at this form,<br /> it would be nice to have a link back to the main errata page.</p> </td><td>2007-01-04</td><td></td></tr> <tr><td>120</td><td></td><td>OK</td><td><p>The code for the total_price method in depot_i/apps/models/cart.rb isn’t working with rails 1.1.6. There is no such method sum for the Array class.</p> <p>(Dave says: upgrade Rails as described inside the front cover)</p> </td><td>2006-12-17</td><td></td></tr> <tr><td>622</td><td>624</td><td>TYPO</td><td><p>It says Configuring Mongrel. It should say “Step Three: Configuring Mongrel” to follow the style of the other 3 steps. (Sorry for my English)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>128</td><td></td><td>OK</td><td><p>Code at bottom of page is wrong:</p> <p>There should be no “do”, all tags need “=”, last tag should be: end_form_tag</p> <p>Correct: (not sure how the ruby brackets will post)</p> <p><%= form_remote_tag :url => { :action => :add_to_cart, :id => product } %><br /> <%= submit_tag “Add to Cart” %><br /> <%= end_form_tag %></p> <p>(Dave says: upgrade Rals as described inside the front cover)</p> </td><td>2006-12-17</td><td></td></tr> <tr><td>493</td><td></td><td>OK</td><td><p>There should be a begin statement on line 19 in the file http://media.pragprog.com/titles/rails2/code/e1/views/app/controllers/products_controller.rb</p> <p>(Dave says: it’s correct as it stands)</p> </td><td>2006-12-17</td><td></td></tr> <tr><td>171</td><td></td><td>SUGGEST</td><td><p>InnoDB Required. Maybe this is not the appropriate place to submit this feedback, but I was having a hard time figuring out why the rollback was occuring, and it turned out to be my fault, but anyway here is why: I did not have InnoDB enabled on MySQL, so the tables were MyISAM, which I now know the transactions require InnoDB tables. I figure this entry might get removed but at least I am conveying the information in case it might be useful to the Authors or someone else working their way through the book.</p> <p>(Dave says: recent Rails should set InnoDB as the default on all tables created by migrations. I do mention InnoDB on page 267 (of the paper book)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>380</td><td></td><td>ERROR</td><td><p>observer in a controller is deprecated in Rails 1.2, and this book covers rails 1.2.</p> <p>(Dave says: rewritten to show the new usage)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>566</td><td>579</td><td>TYPO</td><td><p>“Ruby development wiki” should be “Rails development wiki”</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>203</td><td>196</td><td>SUGGEST</td><td><p>while the third get statement is technically correct, the values suggest the use of three hashes, not one hash with three elements. Shouldn’t it be</p> <p>get :add_to_cart, {:id => …}, {:session_key => …}, :message => …</p> <p>(Dave says: good idea)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>80</td><td></td><td>OK</td><td><p>I get error when I run db:migrate for adding price to table products.</p> <p> AddPrice: migrating ==<br /> — add_column(:products, :price, :decimal, {:precision=>8, :scale=>2, :default=>0})<br /> rake aborted!<br /> You have a nil object when you didn’t expect it!<br /> You might have expected an instance of Array.<br /> The error occured while evaluating nil.[]</p> <p>I try to delete all my records from table, (ass sugested from one user here) but I get the same error.<br /> Then I change price field from decimal->integer (http://www.imarichardson.com/2006/10/01/agile-web-development-with-rails-code-fix/)<br /> and migration works.</p> <p>Is there an error in the book (pdf) or is there something else wrong? Could anybody please give me/us a proper explination.</p> <p>(Dave says: please upgrade to the newer Rails, as described on page 2 of the PDF (just after the cover)</p> </td><td>2006-12-17</td><td></td></tr> <tr><td>156</td><td></td><td>ERROR</td><td><p>The text says that the validate function checks if a password has been set. This is not the case.</p> <p>EXPLANATION: validate checks to see if hashed_password is blank, but even if a blank password is submitted via the form, password= and encrypted_password will set hashed_password to a value (in this case, the hash of ‘wibble’ plus the salt). Therefore, the if clause in validate will never trigger, and null-password users are accepted.</p> <p>POSSIBLE SOLUTION: In password=, check if the pwd argument is empty, and if so simply return without setting hashed_password or salt</p> <p>(Dave says: good catch—adding "return is pwd.blank? after the initial assignment in password= fixes the issue)</p> </td><td>2007-01-04</td><td></td></tr> <tr><td>339</td><td>337</td><td>TYPO</td><td><p>‘end’ of ‘Class Reading’ is not indented</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>508</td><td></td><td>TYPO</td><td><p>“The same mechanism that lets you use yield :layout to embed the rendering of a template into the layout also allows to generate arbitrary content…”</p> <p>Should read “also allows YOU to…”.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>516</td><td>516</td><td>TYPO</td><td><p>“Now that we have a cached version of the article list, our Rails application will to serve it whenever this page is referenced.”</p> <p>Need a verb between will and to.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>241</td><td>236</td><td>TYPO</td><td><p>in Figure 14.3 the URL for the view should start with http: instead of https:</p> </td><td>2007-01-03</td><td></td></tr> <tr><td></td><td>71</td><td>OK</td><td><p>running the rake command with the source code given from the web site produces what is below, what’s happening?</p> <p>michael-slades-computer:~/documents/railsprojects/depot michaelslade$ rake db:migrate —trace<br /> (in /Users/michaelslade/Documents/RailsProjects/depot)</p> <p><strong></strong> Invoke db:migrate (first_time)</p> <p><strong></strong> Invoke environment (first_time)</p> <p><strong></strong> Execute environment</p> <p><strong></strong> Execute db:migrate<br /> AddPrice: migrating ==<br /> — add_column(:products, :price, :decimal, {:default=>0, :precision=>8, :scale=>2})<br /> rake aborted!<br /> You have a nil object when you didn’t expect it!<br /> You might have expected an instance of Array.</p> <p>DAVE SAYS: INSTALL THE CORRECT VERSION OF RAILS AS DOCUMENTED INSIDE THE FRONT COVER</p> </td><td>2006-12-21</td><td></td></tr> <tr><td>223</td><td></td><td>OK</td><td><p>The “assert elapsed_time < 3.00” suggests to me that the test should run under 3 seconds and the sample output has “Finished in 3.840708 seconds” and ’0 failures, 0 errors“. This looks like a mistake to me since 3.840708 is less than 3.00 so I suggest changing the ”3.00" to “4.00” or explaining in the text why test ran without any errors.—Michael Schuh</p> <p>(Dave says: the elapsed time includes Rails setup time)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>171</td><td>163</td><td>SUGGEST</td><td><p>When implementing the code to prevent the last admin from being deleted, the book lists the after_destroy hook method in user.rb. The text then states that, “…the exception signals the error back to the controller, where we use a begin/end block to handle it and report the error to the user in the flash.” However, it does not show this modification to the delete_user method in login_controller.rb — the reader must look back at the code listing to see the change. It would be helpful if the modification to the code was shown as part of the text, as it is for almost all other cases.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>429</td><td></td><td>OK</td><td><p>since the %{} syntax is used so rarely, it might be nice to mention that it is an alternate syntax to double quotes strings, or put a refrence to the symbol in the index</p> <p>(Dave says: it is mentioned back in the tutorial)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td></td><td>71</td><td>OK</td><td><p>To fix error reported on this page, re: install correct version of Rails: before unzipping rails.zip, delete symlink rails -> . Otherwise, upzip fails. This is under Debian Linux.</p> <p>(Dave says: where’d the symlink come from? You shouldn’t need to update in the standard depot application code)</p> </td><td>2006-12-25</td><td></td></tr> <tr><td></td><td>71</td><td>DEFER</td><td><p>Got message trying to do rake db:migrate, saying “no such file /tmp/mysql.sock”. Found fix on web, saying, change database.yml host from localhost to 127.0.0.1. Worked, under Debian Linux.</p> <p>(Dave says: thanks for that)</p> </td><td></td><td></td></tr> <tr><td>51</td><td>41</td><td>TYPO</td><td><p>3rd Paragraph, last sentence:<br /> Replace<br /> %last<br /> with<br /> last</p> <p>Similarly, the newline after <% end %> accounts for the blank line between the %last Ho! and the Merry Christmas! line.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>549</td><td>549</td><td>TYPO</td><td><p>Accidental “=”-character in caption of Figure 23.5: “Drag-and-=Drop To-do Lists”</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>249</td><td></td><td>OK</td><td><p>Why does the in_groups_of helper method require “puts” in the block, but the other helper methods do not require that?</p> <p>(Dave says: because I had to show the calls to the blow in this case…)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>477</td><td>477</td><td>TYPO</td><td><p>(in the printed book too)<br /> at the bottom of the page, last paragraph, third line - there’s an extra word “head.”</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>131</td><td>122</td><td>ERROR</td><td><p>Quirks mode in IE can also be invoked by having the xml declaration before the doctype. Make sure there isn’t a line such as</p> <?xml version="1.0" encoding="UTF-8"?> </td><td>2007-01-03</td><td></td></tr> <tr><td></td><td>71</td><td>OK</td><td><p>Re: How did symlink get create:</p> <p>“rails test” (e.g.) creates test/vendor directory which includes this entry:<br /> lrwxrwxrwx 1 john john 1 2006-12-30 22:37 rails -> .</p> <p>Linux unzip rails.zip from within vendor directory creates multi error messages. Removing the symlink fixes the problem.</p> <p>(Dave says: that’s not something I see here, and seems like a bug in Rails)</p> </td><td>2006-12-31</td><td></td></tr> <tr><td>257</td><td>253</td><td>TYPO</td><td><p>Text reads “if you enabling UTF-8 support”, should probably be “if you enable UTF-8 support”.</p> </td><td>2007-01-03</td><td></td></tr> <tr><td></td><td>160</td><td>OK</td><td><p>In the listing for admin.rhtml in section 11.4, line 11, <%= @page_title || “Pragmatic Bookshelf” %> appears. Shouldn’t ||= be used here instead of ||?</p> <p>(Dave says: no—it isn’t an assignment, it’s just A || B)</p> </td><td>2007-01-03</td><td></td></tr> <tr><td>621</td><td></td><td>SUGGEST</td><td><p>Most of the instructions here carryover onto a Windows development environment gracefully, but when installing mongrel_cluster, gem choses the latest non-win32 version to install as its dependency. This fails (as it can’t be built on Win), so Windows users may need to do a workaround such as:</p> <p>gem install mongrel_cluster -v 0.2.0</p> <p>(While also remembering to install the -win32 version of mongrel)</p> </td><td>2007-01-04</td><td></td></tr> <tr><td>621</td><td></td><td>SUGGEST</td><td><p>For win32, termios is unavailable for Windows, but it is only needed so that your password bits don’t get echo’d out into the world (from reading through the capistrano source in trac)</p> </td><td>2007-01-04</td><td></td></tr> <tr><td>648</td><td></td><td>TYPO</td><td><p>The index says that “schema_format” is described on page 648. It isn’t. It looks like it SHOULD be there, but it isn’t. Woops.</p> <p>(Dave says: it’s there, but the heading is wrong: the second ‘record_timestamps’ should be schema_format)</p> </td><td>2007-01-04</td><td></td></tr> <tr><td>623</td><td></td><td>SUGGEST</td><td><p>Chapter 27, p.623, Step Three: Configuring Mongrel<br /> the deployment path is given as follows:</p> <p>-c /deploy/path/current</p> <p>in the next section p.624 this path is used for a property in config/deploy.rb like this:</p> <p>set :deploy_to, “/Library/Rails/#{application}”</p> <p>as a capistrano-newbie I was irritated two seconds, because the paths don’t correlate.</p> <p>(Dave says: well, they do correlate, but it is subtle. I’ve added some extra text)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>416</td><td>415</td><td>TYPO</td><td><p>I think it should say “added by” rather than “adding by”</p> <p>This adds the following routes to the standard set adding by map.resources.</p> </td><td>2007-01-08</td><td></td></tr> <tr><td>180</td><td></td><td>OK</td><td><p>In the “Autogenerating the XML” section the example code says:</p> <p>respond_to do |accepts|</p> <p>In previous pages (178) the same code snippet used “format” as the block variable.</p> <p>I think you should maintain the same variable name.</p> <p>(Dave says: ah, consistency. I’m really bad at it :)</p> </td><td>2007-01-07</td><td></td></tr> <tr><td></td><td>71</td><td>SUGGEST</td><td><p>Re my earlier note:</p> <p>“#5985: Got message trying to do rake db:migrate, saying ”no such file /tmp/mysql.sock“. Found fix on web, saying, change database.yml host from localhost to 127.0.0.1. Worked, under Debian Linux.”</p> <p>Made my way to page 289 re: MySQL adapter. I installed the C bindings as suggested, changed the database.yml host back to localhost and all worked fine. I specifically checked the socket value —which had been the reported problem — per top of page 290 and got the expected result.</p> <p>The performance difference with the depot application are palpable!</p> <p>Also, FWIW, I needed to install libmysqlclient-dev library (Debian testing) to get the gem to install. Suggest adding this recommendation.</p> </td><td>2007-04-26</td><td></td></tr> <tr><td></td><td>176</td><td>OK</td><td><p>The performance test is misleading since it is not measuring the time it takes to save 100 valid orders. It records the time taken to save 200 orders and 1 line item. Since save_order empties the cart, only one line item is ever saved. Would this be more realistic:</p> <p>require File.dirname(<em>FILE</em>) + ‘/../test_helper’<br /> require ‘store_controller’</p> <p>class OrderTest < Test::Unit::TestCase<br /> fixtures :products<br /> HOW_MANY = 100</p> <p>def setup<br /> <code>controller = StoreController.new </code>request = ActionController::TestRequest.new<br /> @response = ActionController::TestResponse.new<br /> end</p> <p>def teardown<br /> LineItem.delete_all<br /> Order.delete_all<br /> end</p> <p>def test_save_bulk_orders<br /> Fixtures.create_fixtures(File.dirname(<em>FILE</em>) +<br /> “/../fixtures/performance”, “orders”)<br /> elapsedSeconds = Benchmark::realtime do<br /> assert_equal(HOW_MANY, Order.find_all.size)<br /> 1.upto(HOW_MANY) do |id|<br /> order = Order.find(id)<br /> get :add_to_cart, :id => products(:version_control_book).id<br /> get :save_order, :order => order.attributes<br /> assert_redirected_to :action => ‘index’<br /> assert_equal(“Thank you for your order.”, flash[:notice])<br /> end<br /> end<br /> assert elapsedSeconds < 8.0, “Actually took #{elapsedSeconds} seconds”<br /> puts elapsedSeconds<br /> end<br /> end</p> <p>(Dave says: I believe it’s OK, modulo database caching. The test creates 100 orders and saves them. Each order contains a different line item.)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>212</td><td></td><td>TYPO</td><td><p>“Addition Assertions” should probably read “Additional Assertions”</p> </td><td>2007-05-02</td><td></td></tr> <tr><td></td><td>40</td><td>SUGGEST</td><td><p>This is nitpicking, but the HTML output and “in the browser window” text at the bottom of page 40, and the screen shot on page 44, all show different dates for the “time in one hour” output.</p> <p>(Dave says: just goes to show how dynamic the book production process is… :)</p> </td><td>2007-04-29</td><td></td></tr> <tr><td>223</td><td></td><td>ERROR</td><td><p>The file http://media.pragprog.com/titles/rails2/code/depot_r/test/performance/order_speed_test.rb is different from the code in the book. And it’s wrong.</p> <p>The book (correctly) says:</p> <ol> <li>Re-raise errors caught by the controller.<br /> class StoreController; def rescue_action(e) raise e end; end</li> </ol> <p>And the file (wrongly) says:</p> <ol> <li>Re-raise errors caught by the controller.<br /> class OrderController; def rescue_action(e) raise e end; end</li> </ol> <p>The OrderController doesn’t exists and the controller instance to use is StoreController.</p> </td><td>2007-01-14</td><td></td></tr> <tr><td></td><td>17</td><td>OK</td><td><p>Page missing. Page 19 is duplicated here.</p> <p>(Dave says: if you bought the book from us, drop support@pragprog.com an email. Otherwise, the store you bought it from should replace it for you.)</p> </td><td>2007-01-14</td><td></td></tr> <tr><td>87</td><td></td><td>OK</td><td><p>After generating the static scaffold, HTML tags in the item descriptions are now taken as literals (they are shown on the rendered page). This is caused by the “h” in the phrase <<span style="text-align:center;">h product.send(column.name)</span>>. On page 77 (pdf), the entered description is shown with a leading</p> <p> <p>, which is taken as a real HTML tag when rendering with the dynamic scaffold. The book is inconsistent, as is Rails (1.2rc2).</p> <p>(Dave says: no—this isn’t a problem. The scaffold output shows the tags. This is good. However the store index does not: it interprets them as intended(</p> </td><td>2007-01-14</td><td></td></tr> <tr><td>389</td><td></td><td>OK</td><td><p>Transaction with distributed databases is a complex problem and I understand that it is not supported by ActiveRecord.</p> <p>But what about a transaction involving different models (i.e. tables) belonging to the same database ?<br /> Is it supported by ActiveRecord ?<br /> The example only illustrates a transaction involving a unique Model (Account).</p> <p>(Dave says: database transactions apply to database connections, not tables, so the answer is yes)</p> </td><td>2007-01-15</td><td></td></tr> <tr><td></td><td>34</td><td>OK</td><td><p>Note 1 at the bottom of the page claims that command script/server would start Mongrel or lighttpd instead of WEBrick if one of these servers is installed. It does not seem to do that with Mongrel on my Windows XP computer that has Mongrel installed by installing Instant Rails 1.4. Readme.html for Rails 1.2 mentions that script/server should start lighttpd (if installed) but does not make a similar claim for Mongrel.</p> <p>(DAve says: make sure it’s in your path—it works fine here)</p> </td><td>2007-01-15</td><td></td></tr> <tr><td>180</td><td></td><td>ERROR</td><td><p>The routes.rb file already has the last mapping (using :id.:format). This is with Rails 1.2rc2</p> </td><td>2007-05-02</td><td></td></tr> <tr><td></td><td>23</td><td>OK</td><td><p>Figure 3.1 shows rails version number 1.1.2 while book uses 1.2</p> <p>(Dave says: 1.2 was not released at the time the book was printed (and even at the time you reported this) so there’s no way InstantRails could install it… :)</p> </td><td>2007-01-17</td><td></td></tr> <tr><td>188</td><td></td><td>TYPO</td><td><p>Second try at product_test ends with a line containing “2 errors”, but only one error is listed. My result said “1 errors”.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>191</td><td></td><td>ERROR</td><td><p>The contents of the auto-generated products.yml file do not match what Rails 1.2 rc2 actually generates. The book says that the rows are named “first” and “another”, but Rails actually generates “one” and “two”.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>2</td><td></td><td>SUGGEST</td><td><p>Two suggestions:<br /> 1) I guess this should have been obvious but it just never occured to me. I started with rails 1.1.6. I saw that I needed to download something and so I followed those steps. For whatever reason, I thought this had a global change. But it turns out that every time I create a new rails applications (the book creates at least two), I need to do this step. Thats fine of course but I didn’t realize that. So, my suggestion is to just add an explicit statement that this step needs to be done for each rails application created.<br /> 2) After the steps are done to add in the new code, it would be nice to have some way to verify that the add worked correctly. Typing “rails -v” still produces 1.1.6. Maybe give a small script that fails before the new code is added in and succeeds afterwards.</p> <p>(Dave says: I hear 1.2 will be released in the next day or so, so this problem should evaporate)</p> </td><td>2007-01-17</td><td></td></tr> <tr><td>132</td><td></td><td>SUGGEST</td><td><p>Section 9.3<br /> It would be helpful to put change indicator arrows against add_product in cart.rb. Where in the else clause the statement was split into two lines to ensure that current_item was set. I missed this and got javascript errors when adding the product for the first time.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>666</td><td>SUGGEST</td><td><p>Use ‘image_tag’ rather than ‘img src’ in the Depot application. (As it stands Depot doesn’t work on a relative path). Diff attached.</p> <p>Index: app/views/layouts/store.rhtml<br /> ===<br /> —- app/views/layouts/store.rhtml\t(revision 22)<br /> <span class="underline"></span>+ app/views/layouts/store.rhtml\t(working copy)<br /> @@ –16,7 +16,7 @@</p> <body id="store"> <div id="banner"> <p>- <img src="/images/logo.png"/><br /> + <%= image_tag(“logo.png”) %><br /> <%= <code>page_title || "Pragmatic Bookshelf" %> </div> <div id="columns"> Index: app/views/layouts/admin.rhtml =================================================================== --- app/views/layouts/admin.rhtml\t(revision 22) +++ app/views/layouts/admin.rhtml\t(working copy) </code>@ –12,7 +12,7 @@</p> </head> <body id="admin"> <div id="banner"> <p>- <img src="/images/logo.png"/><br /> + <%= image_tag(“logo.png”) %><br /> <%= <code>page_title || "Pragmatic Bookshelf" %> </div> <div id="columns"> Index: app/views/store/index.rhtml =================================================================== --- app/views/store/index.rhtml\t(revision 22) +++ app/views/store/index.rhtml\t(working copy) </code>@ –7,7 +7,7 @@</p> <p><% for product in @products -%></p> <div class="entry"> <p>- <img src="<%= product.image_url %>"/><br /> + <%= image_tag(product.image_url) %></p> <h3> <p><%= h(product.title) %></p> </h3> <p><%= product.description %></p> <div class="price-line"> </td><td>2007-05-04</td><td></td></tr> <tr><td>163</td><td></td><td>SUGGEST</td><td><p>def login<br /> session[:user_id] = nil<br /> if request.post?<br /> user = User.authenticate(params[:name], params[:password])<br /> if user<br /> session[:user_id] = user.id<br /> redirect_to(:action => “index”)<br /> else<br /> flash[:notice] = “Invalid user/password combination”<br /> end<br /> end<br /> end</p> <p>in this code snippet should flash[:notice] not be flash.now ?</p> <p>(Dave says: yes)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>624</td><td></td><td>ERROR</td><td><p>With the current version of Capistrano (1.3.1), it appears the book’s directions are now deprecated:</p> <p>frost% rake remote:setup<br /> (in /Users/watts/work/report-tool)<br /> Capistrano/Rake integration is deprecated.<br /> Please invoke the ‘cap’ command directly: `cap setup’</p> <p>I continued using ‘cap cold_deploy’ rather than rake and didn’t get a warning.</p> <p>(Dave says: yes—all the rake remote: stuff should now be “cap …”)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>203</td><td></td><td>SUGGEST</td><td><p>This issue is subject to issue #6093 where i had suggested using flash.now[:notice] instead of flash[:now].</p> <p>if that suggestion is valid, then the functional test fails for LoginController test_bad_password.</p> <p>the observation is flash.now[:notice] does not hang around in the session for functional tests.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>420</td><td></td><td>SUGGEST</td><td><p>“except we’ll omit ‘index’ and ‘show’, because comments are displayed only in the context of an article”: This is confusing, because /articles/1/comments would still be “in the context of an article”. How about “…because comments are displayed only from within the article’s ‘show’ action”, or something like that?</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>421</td><td></td><td>SUGGEST</td><td><p>In the ‘destroy’ action, it seems like the params[:id].to_i could be written simply as params[:id], as it is in all the other actions.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>592</td><td></td><td>TYPO</td><td><p>The end of the first sentence in the box reads “by sending an identifier which to API the method call should go”. “which to API” should be “to which API”, shouldn’t it?</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>128</td><td></td><td>OK</td><td><p>The code at the bottom of the page 128 to add form (AJAX enabled) doesn’t work. Using that code, the “Add to Cart” button is not displayed. Even the code on url: http://media.pragprog.com/titles/rails2/code/depot_l/app/views/store/index.rhtml mentioned as link on the same page is erroneous and deos not display the “Add to cart” button.<br /> I changed it as follows and it worked:</p> <p><%= form_remote_tag (:url => { :action => :add_to_cart, :id => product }) %><br /> <%= submit_tag (“Add to Cart”) %><br /> <%= end_form_tag %></p> <p>Maybe the erperienced team at Pragmatic Programmers might have a better fix to that problem.</p> <p>NOTE: I tried finding solution on google, but nobody had posted any solution for this problem and there are a lot of people waiting for solution. So if u can post the upadted solution somewhere on rubyonrails.org, that will be great - i posted it on google-groups.</p> <p>(Dave says: upgrade to the version of Rails as described inside the front cover (or use the newly released Rails 1.2 gem)</p> </td><td>2007-01-21</td><td></td></tr> <tr><td>459</td><td></td><td>TYPO</td><td><p>the - “def update_article … end” - has code to create a db-entry instead of updating one:<br /> “article = Article.new(params[:article])<br /> if article.save”<br /> Should be:<br /> “<code>article = Article.find(params[:id]) if </code>article.update_attributes(params[:article])”</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>125</td><td></td><td>SUGGEST</td><td><p>“stick that HTML into the DOM”.<br /> Since you mention the DOM, it would be nice to have some quick note on what it is, and how it applies to rails.<br /> I’ve looked around in the web (wikipedia and more) and it seems like a pretty hard concept to grasp (I eventually gave up), so it would be nice if you gave it a try.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>34</td><td></td><td>SUGGEST</td><td><p>The third paragrph under Installing on Mac OS X says that Locomotive uses SQLite and talks about how this could cause problems with the rest of the book because the book uses MySQL. I’m not clear if the issue is that MySQL is not installed on Macs by default</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>115</td><td></td><td>OK</td><td><p>For the method add_to_cart in the store_controller it states to rescue the exception ActiveRecord::RecordNotFound. However when I run the example with add_to_cart/wibble it actually throws the exceptoin ActiveRecord::StatementInvalid. If I pass a number it throws a RecordNotFound.</p> <p>(Dave says: I tried with MySQL and I see RecordNotFound. The fact that other databases throw different errors is described in the footnote)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>299</td><td></td><td>TYPO</td><td><p>In the sentence “A call to Person.find(5) is based on our knowledge of the person table.”, the table name should be plural, especially in light of the emphasis on naming conventions.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>285</td><td></td><td>ERROR</td><td><p>“def self.up” lacks closing “end”</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>306</td><td></td><td>SUGGEST</td><td><p>“Rails 1.1 adds…” should be past tense, or just say “You can perform statistics…”.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>522</td><td></td><td>TYPO</td><td><p>“…Prototype and Script.aculo.us are found<br /> in ActionPack::Helpers::PrototypeHelper and ActionPack::Helpers::ScriptaculousHelper.<br /> RJS templates, on the other …”</p> <p>It should actually be ActionView::Helpers::PrototypeHelper and ActionView::Helpers::ScriptaculousHelper</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>628</td><td></td><td>ERROR</td><td><p>The book suggests this as a way to clear out sessions:<br /> > RAILS_ENV=production ./script/runner \\<br /> ‘ActiveRecord::Base.connection.delete(<br /> “DELETE FROM sessions WHERE updated_at < now() - 12*3600”)’</p> <p>One might think that “now() - 12*3600” means 12 hours ago, and it might with some databases. In mysql now returns a bizarre integer like creature that is really the date as a single number, but you can’t do math on that number. Actually, you an do math on the number but it is non-nonsensical. Please review:<br /> http: //dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_now</p> <p>Instead, I would use this function:</p> <p>script/runner -e production “ActiveRecord::Base.connection.delete(\\”delete from sessions where updated_at < ‘#{ActiveRecord::Base.connection.quoted_date(12.hours.ago)}’\\“)”</p> <p>This uses the handy rails time routines, and converts to a db specific version.</p> <p>(Dave says: even better… how about</p> <p>CGI::Session::ActiveRecordStore::Session.delete([“updated_at < ?”, 12.hours.ago])</p> <p>)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>607</td><td></td><td>ERROR</td><td><p>About the middle of the page:</p> <p>Once installed, you add support to all your application</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>410</td><td>ERROR</td><td><p>I am not sure if this is me or the code I downloaded. The problem I have is in the comments section of restful2 of the download code. When I try to “Add a comment” I get a routing error. The code :url => comment_url in the view<del><span style="text-align:right;">comments</span></del>>new.rhtml will look for a “show” action in comments which does not exist. So I tried to change the :url => edit_comment_url which has a routing error also. Any Ideas???</p> <p>(Dave says: it should say “comments_url”)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>546</td><td></td><td>ERROR</td><td><p>All three</p> <div> <p>tags on this page are printed as singleton tags, i.e. <div … />, where they should be <div …></p> </div> <p>. The former method fails to render correctly in most browsers. See XHTML spec, appendix C, #3: http: //www.w3.org/TR/xhtml1/</p> <p>Thanks!</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>353</td><td>TYPO</td><td><p>In your demo code for acts_as_list, you have for the Child:<br /> acts_as_list :scope => :parent_id</p> <p>However, 1.2.1 complains then that position_id cannot be found — by leaving off the _id it behaves as expected.</p> <p>(Dave says: either works for me in 1.2.3, but I’ve changed it to parent)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>608</td><td></td><td>TYPO</td><td><p>(2nd sentence) The ssl_allowed declaration lists actions taht … (change taht to that)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>143</td><td></td><td>TYPO</td><td><p>The last line of code on the page uses the button_to method, but in the previous chapter this was updated to form_remote_tag.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>226</td><td></td><td>ERROR</td><td><p>FlexMock has been removed from ActiveSupport, but the book still lists it as available in Rails as of Rails 1.2.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>304</td><td></td><td>TYPO</td><td><p>The code to find entries has a typo where a ‘)’ needs to be replaced by a comma (the line starting with :joins).</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>475</td><td></td><td>TYPO</td><td><p>“Yet another set of helpers deal with text”. Probably should be “deals with text” as you talking about set here.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>438</td><td></td><td>ERROR</td><td><p>The book states this:<br /> "</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>376</td><td></td><td>ERROR</td><td><p>Your normalize_credit_card() method removed numbers from the String and I doubt that is what you intended. A better regex is probably /\\D+/. Or, if you meant to allow dashes and alphanumeric characters, /[^\\-\\w]+/. The same problematic method appears on page 377 as well.</p> <p>(Dave says: changed to</p> <p>self.cc_number.gsub!(/[-\\s]/, ’’)</p> <p>)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>378</td><td></td><td>TYPO</td><td><p>Encrypter#initialize() is missing an asterisk before the attrs_to_manage argument. You pass it multiple arguments in the example at the bottom of the page, but it only accepts one as defined.</p> <p>When you fix this, your ActiveRecord::Base::encrypt() method on page 379 will be broken. You will need to add another asterisk before attr_names (in the method body, not the parameter list).</p> <p>(Dave says: actually, the method is correct. It’s the single use in the first (bad) illustration of use that’s wrong—it should have brackets around the parameter)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>367</td><td></td><td>TYPO</td><td><p>The examples on this page are not syntax highlighted as Ruby code. Compare with the examples on the facing page to see what I mean.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>397</td><td></td><td>TYPO</td><td><p>The prose of this page refers to a use_controllers() method, but all of the examples actually call use_controllers!().</p> <p>(Dave says: it should be the form with the !)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>531</td><td></td><td>TYPO</td><td><p>“:success,:failure” needs a space</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>356</td><td>TYPO</td><td><p>Text “…and add the column catgories_count to your table.” should have categories_count (with the ‘e’)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>166</td><td></td><td>ERROR</td><td><p>The listing of application.rb should include the following lines after the class declaration:</p> <p># Pick a unique cookie name to distinguish our session data from others’<br /> session :session_key => ‘_depot_session_id’</p> <p>(Dave says: thanks. I also added a paragraph about this)</p> </td><td>2007-05-01</td><td></td></tr> <tr><td></td><td>417</td><td>TYPO</td><td><p>Helper method for ‘destroy comment’ action at bottom of page should read ‘comments_url(:article_id => 1, :id => 99)’</p> <p>(Dave says: I believe it is correct as it stands)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>84</td><td></td><td>OK</td><td><p>Instead of 1 error, in Figure 6.3, the validation catches 2 errors:<br /> * Price is not a number<br /> * Price should be at least 0.01 (wibble.to_i < 0.01)<br /> I don’t know why your Depot catches only 1 error with these validation.</p> <p>(Dave says: because that figure is references from the place in the flow where we’ve just done the numericality test, and not the range test)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>704</td><td>TYPO</td><td><p>InnoDB in the index points to ‘Database, InnoDB’,<br /> but there is nothing under ‘Database’ which refers to ‘InnoDB’.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>431</td><td></td><td>TYPO</td><td><p>an angle bracket is missing from the first line on this page [:locals => hash]</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>119</td><td>OK</td><td><p>The last example on the page says “<% form_remote_tag … %>”</p> <p>I think it should be “<%= form_remote_tag … <span style="text-align:right;">“. Besides that, I think the ”<</span> end %>” on line 3 is supposed to be “<%= end_form_tag %>”.</p> <p>(Dave says: it is correct as it is (but you need Ruby 1,2)</p> </td><td>2007-03-07</td><td></td></tr> <tr><td>379</td><td></td><td>OK</td><td><p>Shouldn’t the encryption of “Dave Thomas” be “Ebwf Uipnbt” instead of the value shown in the SELECT-result: “Dbwf Tipnbt”?</p> <p>(Dave says: no—it only maps lower case)</p> </td><td>2007-04-26</td><td></td></tr> <tr><td></td><td>79</td><td>OK</td><td><p>depot_c/db/migrate/003_add_test_data.rb</p> <p>After pasting the code and migrating, the database was not updating. To get it to work, I replaced this code:</p> <p>class AddTestData < ActiveRecord::Migration<br /> def self.up<br /> Product.delete_all</p> <p>With this code:</p> <p>class AddTestData < ActiveRecord::Migration<br /> def self.up<br /> Product.delete(:all)</p> <p>(Dave says: I believe that delete_all is correct. In 1.2.3, delete takes a record ID, not the :all parameter)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>400</td><td></td><td>ERROR</td><td><p>The file restful2/app/views/comments/new.rhtml causes an error at the line</p> <p><% form_for :comment, :url => comment_url, :article_id => <code>article_id do |form| %> and As per www.mail-archive.com/rubyonrails-core</code>googlegroups.com/msg01351.html, the line should be</p> <p><% form_for :comment, :url => comments_url, :article_id => @article_id do |form| %><br /> This is to conform with Rails 1.2.2.</p> <p>Pretty proud I’m a noob and figured this out :)</p> <p>(Dave says: good catch)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>539</td><td></td><td>ERROR</td><td><p>The sample code for the onsubmit handler does not meet syntax rules due to the hash in the beginning of the form_tag.</p> <p><% form_tag ‘send_email_without_ajax’, {:onsubmit => ‘return false;’} do %> would meet syntax rules & provide the expected behavior.</p> <p>(Dave says: changed to</p> <p>\t <% form_tag({:action => ‘send_email_without_ajax’},<br /> \t {:onsubmit => ‘return false;’}) do %></p> <p>)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>509</td><td></td><td>TYPO</td><td><p>singular/plural typo:<br /> “We’ll use the content_for mechanism in those template to define….”<br /> should probably read “We’ll use the content_for mechanism in those templates to define….”</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>202</td><td></td><td>OK</td><td><p>following the book for “test_index_with_user” which should set the :user_id in the session.<br /> Setting the :user_id in the session does not work (using rails 1.2.2 on OSX)<br /> i.e.<br /> def test_index_with_user<br /> get :index, {}, { :user_id => users(:dave).id }<br /> When the authorize method is reached (via before_filter) the session variable is not set (I have verified the user is found from the fixture).<br /> The docs for ActionController::Integration::Session::get indicate that the third parameter are for HTTP headers, not session data (not 100% sure this is the correct get method).<br /> The following which worked for me<br /> def test_index_with_user<br /> @request.session[:user_id] = users(:dave).id<br /> get :index</p> <p>This is based on an example I googled at [http]blog.testingrails.com/2006/8/17/functional-testing-users-authentication-and-logins-with-ruby-on-rails</p> <p>(Dave says: the code is correct as it stands with 1.2.3)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td></td><td>150</td><td>OK</td><td><p>User validates that <code>hashed_password is not blank, but the attribute writer method you have for </code>password does not check to see if the supplied password is blank before calling the encrypted_password function, which, in turn does not check to see if that parameter is blank. It then returns a non-blank hash string.</p> <p>My solution is to adjust the @password attribute writer to check to see if the supplied arguement is blank/nil, and only setting hashed_password if it is not:</p> <p>def password=(pwd)<br /> <code>password = pwd create_new_salt unless( </code>pasword.nil? || @password == ’’)<br /> self.hashed_password = User.encrypted_password( self.password , self.salt )<br /> end<br /> end</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>150</td><td>TYPO</td><td><p>On further checking, guess it should be a ‘typo’, since the code (directory depot_p onward) downloaded from this site shows a check<br /> return if pwd.blank?<br /> in<br /> def password=(pwd)</p> <p>So corrections should be on pgs 150, 151, and 666.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>504</td><td></td><td>OK</td><td><p>I’m pretty sure there’s a bug in one of your regular expressions.</p> <p>def base_part_of(file_name)<br /> File.basename(file_name).gsub(/[^\\w._-]/, ’’)<br /> end</p> <p>In gsub, the “.” should be “\\.”, no?</p> <p>(Dave says: no—. is literal in [])</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>533</td><td></td><td>TYPO</td><td><p>"…container element (often a</p> <div> <p>, but it can<br /> be any element with an id.)"</p> <p>The period should be after the close-parenthesis.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>171</td><td></td><td>SUGGEST</td><td><p>“in theory A could delete B at just the same time that B deletes A.”</p> <p>If this is really possible, then with the new Active Record hook, would both these transactions be rolled back?</p> <p>(Dave says: In theory, yes. THis would seem to be a safe thing to do)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>261</td><td></td><td>TYPO</td><td><p>In the code shown from the download “e1/namelist/app/views/people/index.rhtml” the first td element (for person.name) is not closed.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>279</td><td></td><td>SUGGEST</td><td><p>The color coding after the #-sign appears wrong in the first code fragment under “Extending Migrations” (“execute %{alter table #{from_table}” etc.) I’m guessing this is because the string it appears in is not a double quoted one. There also seems to be a problem with the color coding when commented output is displayed that runs over more than one line (see: page 251 after “puts count.inspect”). One other case where I believe the color coding to be confusing is when the output of creating a new object is displayed (see: page 174 after “prd = Product.new”).</p> <p>(Dave says: indeed there is. Out production system does it’s best, but it isn’t a full Ruby parser)</p> </td><td>2007-04-26</td><td></td></tr> <tr><td>341</td><td></td><td>TYPO</td><td><p>The has_many :users, :through => :readings has an incorrect parameter, :unique. It should be:</p> <p>has_many :users, :through => :readings, :uniq => true</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>134</td><td>OK</td><td><p>In the code for the _cart.rhtml file the code for the “Empty cart” button has been changed back to <%= button_to…%> from the <form_remote_tag…> that was added so that the AJAX would work. It also appears like this at the top of page 671 in the full source code for the Depot application.</p> <p>(Dave says: I don’t believe “Empty cart” was ever implemented using form_remote_tag)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>80</td><td>TYPO</td><td><p>The code download for 003_add_test_data.rb differs from the book. It includes<br /> Product.delete_all<br /> in the self.up definition as well as the self.down definition.<br /> I’m assuming this is to clear any stuff the learner put into the database while toying with the depot app?<br /> I don’t know if it is a typo or an error.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>115</td><td></td><td>SUGGEST</td><td><p>It seems odd to use an else clause in add_to_cart.</p> <p>If Product.find doesn’t throw an exception, you can carry straight on to find the cart and add the product to it. The normal flow is kept together, and the code is easier to read.</p> <p>(Dave says: I wanted to show the different flows explicitly)</p> </td><td>2007-04-26</td><td></td></tr> <tr><td>36</td><td></td><td>TYPO</td><td><p>Second para, last sentence, “superceded” should be “superseded”.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>680</td><td></td><td>TYPO</td><td><p>In depot.css, the comment “And entry in the store catalog” should read “An entry in the store catalog”.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>130</td><td></td><td>SUGGEST</td><td><p>Just adding my voice to “Some readers have reported that they have to stop and start their application to get the AJAX-based cart to work.” With Rails 1.2.3 and Mongrel on OS X I had an error logged showing that Rails was still looking for add_to_cart.rhtml, and not finding it. Restarting Mongrel cleared the problem.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>173</td><td></td><td>SUGGEST</td><td><p>The footnote says we’ll see later how to populate database tables as part of a migration. In fact we already did, in 003_add_test_data.rb (page 88, in section 6.4).</p> <p>(Dave says: true, but the forward reference is the detailed version)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>178</td><td></td><td>SUGGEST</td><td><p>It would be good to warn readers to check what product IDs they have in their database. Migration 003 deleted existing products before inserting three ‘standard’ ones, so the valid IDs are not likely to start at 1.</p> <p>(Dave says: I added a note saying that the table was cleared)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>187</td><td></td><td>SUGGEST</td><td><p>"…if we</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>197</td><td></td><td>SUGGEST</td><td><p>We have created and run some unit tests for Product, and gone on to create and run some for Cart, re-using and adding to the products fixture. Now would be a good time to learn about rake test:units (which also covers preparing the test DB schema). But (unlike the first edition) there’s no mention of using rake to run tests in the Testing chapter. A quick search suggests it’s not covered in Part III, either.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>121</td><td></td><td>TYPO</td><td><p>The following text is missing a closing parenthesis:</p> <p>(The first time through, your count won</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>625</td><td>ERROR</td><td><p>Before running rake remote:cold_deploy, you need to commit the newly-created config files into version control or else it will fail when starting the Mongrel cluster. If using Subversion, this will entail the following:</p> <p>svn add config/mongrel_cluster.yml<br /> svn add config/deploy.rb<br /> svn add lib/tasks/capistrano.rake<br /> svn commit</p> <p>(Dave says: the rake task is no longer needed, but adding the other two is a good point)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>109</td><td>OK</td><td><p>After adding an item to the cart if the user refreshes the page the item gets added again.</p> <p>(Dave says: I don’t see this—if I hit refresh the browser warns me about resubmitting the form)</p> </td><td>2007-04-29</td><td></td></tr> <tr><td>80</td><td></td><td>TYPO</td><td><p>after changing db/migrate/002_add_price.rb I run: user@host$ rake db:migrate<br /> i got this:<br /> AddPrice: migrating ==<br /> — add_column(:products, :price, :decimal, {:precision=>8, :default=>0, :scale=>2})<br /> rake aborted!<br /> You have a nil object when you didn’t expect it!<br /> You might have expected an instance of Array.<br /> The error occured while evaluating nil.[]</p> <p>(Dave says: you need a more recent version of Rails)</p> </td><td>2007-04-26</td><td></td></tr> <tr><td>160</td><td></td><td>OK</td><td><p>I just did a “svn update vendor/rails” to put my Rails up to date (Rev 6495). When I ran “ruby script/generate controller Login add_user login logout index delete_user list_users” the output did not generate .rhtml files but .erb instead. After downloading your .rthml into its proper directories and running “localhost:3000/login/add_user” I got</p> <p>Login#add_user</p> <p>Find me in app/views/login/add_user.erb</p> <p>Why is this not working?</p> <p>(Dave says: because you’re on Edge Rails, and that is not compatible with Rails 1.2)</p> </td><td>2007-04-29</td><td></td></tr> <tr><td>598</td><td></td><td>ERROR</td><td><p>There are two mistakes in the following paragraph:</p> <p>“For delegated and layered dispatching, the information<br /> telling us which service object the invocation should be routed to is embedded in the request.<br /> For delegated dispatching we rely on the controller action name to determine which service it should go to.”</p> <p>I have noted the needed changes IN CAPS…</p> <p>#1: The first sentence should read:<br /> “For DIRECT and layered dispatching,…”</p> <p>#2: The last sentence should read:<br /> “For delegated dispatching we rely on the SERVICE NAME to determine which service it should go to.”</p> <p>BTW, I LOVE this book and think it is extremely well-written. However, the “Web Services on Rails” chapter is really not well-written at all, and (in my opinion) is as confusing as it is informative. I hate to say something negative like that about the author, Leon Breedt, whom I’m sure has done a TON of good Rails work (far more than I, as I’m a newbie), but those are my feelings, so I thought I’d share them.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>79</td><td>SUGGEST</td><td><p>It would be really helpful to mention that when running the add_test_data migration, any invalid records will fail silently, and just be skipped. I ran into the same problem that I’ve seen other people post post about, where running the script (downloaded from media.pragprog.com) didn’t insert any rows, but did not print any errors, and it turned out I had mis-typed the regular expression to validate the image_url field so that all rows were “failing” because .jpg wasn’t accepted.</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>115</td><td></td><td>OK</td><td><p>Testing the given solution for parameter feeding on address bar, I noticed that if I add an item to the cart with the Add to cart button and then I type in the addres anything, leaving the item Id of the recently added item and hit enter that item is re-added to the cart.</p> <p>Maybe a good playtime stuff to solve ;)</p> <p>(Dave says: I’m not sure I see it as a problem as much as a fact of life with HTTP)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>117</td><td>OK</td><td><p>if you keep the code on page 117 as is:</p> <div id="cart"> <p><%= render(:partial => “cart” . . . .</p> </div> <p>then the javascript that comes later fails after the first call (Element.replace)</p> <p>I fixed it by removing the div tags from the code here and added them to the code for app/views/store/add_to_cart.rhtml on page 115</p> <p>(Dave says: I’ve tried this again here and it seems to work fine)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>77</td><td>68</td><td>TYPO</td><td><p>The description of the first product seems to contain an HTML</p> <p> <p>aragraph, so ‘—-’ should better be expressed as ‘—’.</p> <p>(Dave says: ideally…)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>383</td><td></td><td>ERROR</td><td><p>Your select previous to this snippet below does not include “id”, so this code would give an error. I feel like I’m nit-picking, so do with it as you will.</p> <p>result.each do |line_item|<br /> puts “Line item #{line_item.id}: #{line_item.total_price}”<br /> end</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>369</td><td></td><td>ERROR</td><td><p>Syntax highlighting is off: “in” in the validates_format_of regexp is colored different from the rest of the regexp.</p> <p>(Dave says: yes—our syntax highlighter can be fooled…)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>359</td><td></td><td>SUGGEST</td><td><p>Counter cache is mentioned as though the reader knows what it is, but it’s actually not introduced until a couple of pages later.</p> <p>(Dave says: but there.s a reference to the page where it <em>is</em> defined. It’s a circular thing…)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>270</td><td></td><td>ERROR</td><td><p>“raise ActiveRecord::IrreversibleMigration” in self.down is indented more than the corresponding self.up body is.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>266</td><td></td><td>TYPO</td><td><p>SomeMeaningfulname should probably be SomeMeaningfulName.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>258</td><td></td><td>SUGGEST</td><td><p>The Unicode Name Application doesn’t demonstrate that the database actually handles UTF-8 properly: I would suggest using e.g. a MySQL VARCHAR (7) and then demonstrating that "G</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>243</td><td></td><td>ERROR</td><td><p>"In particular, if you have code in the lib directory or one of its subdirectories, you</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>651</td><td></td><td>TYPO</td><td><p>javaScript -> JavaScript in the config.action_view.debug_rjs explanation.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>649</td><td></td><td>ERROR</td><td><p>“Defaults to the public_html directory of the application.” in the config.action_controller.asset_host section should possibly say “public” rather than “public_html”.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>208</td><td></td><td>ERROR</td><td><p>CSS “foo#bar” is syntax highlighted as though “#bar” is a comment. Also, “# comment” is used for comments alongside the CSS examples, though CSS comments are actually “/* Like this */”. Same applies to the next page (209).</p> <p>(Dave says: our syntax highlighter can’t cope with this construct. Sorry. However, the comments are indeed OK—these are not CSS snippets)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>197</td><td></td><td>TYPO</td><td><p>Missing closing parentheses here:</p> <p>assert_nil(User.find_by_name(“willard”)<br /> assert_not_nil(User.find_by_name(“henry”)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>167</td><td></td><td>SUGGEST</td><td><p>It would be a good idea to mention to the reader that if she is using the “A Friendlier Login System” described on page 167 then the “before_filter :authorize, :except => :login” should become "before_filter :authorize, :except => [ :login, :logout] because, if she clicks on logout while being logged out, she will be redirected to logout as soon as she is logged in.</p> <p>(Dave says: you’re correct, but it would involve some pretty good reflexes to actually cause this to happen :)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td></td><td>424</td><td>SUGGEST</td><td><p>On page 424, in the ‘params’ section, there’s mention of ’</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>192</td><td></td><td>SUGGEST</td><td><p>When defining the test fixture, it might be helpful to note that you have to include the “id:” field explicitly here. I had gotten used to blissfully “forgetting” about the “_id” key fields while reading and developing, but I ran into some “ActiveRecord::RecordNotFound: Couldn’t find ClassName without an ID” errors that were rather confusing until I realized I hadn’t included them in the YAML file.</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>130</td><td></td><td>ERROR</td><td><p>The user above that stated “with add_cart.js visual effect only works…..” I ran into the same issue, but the problem is not the book the problem is user error. I had forgotten to edit the cart.rb file and initialize current_item in the else portion of the if statement in the add_product method. Check your code against the changes in the book. It works :)</p> </td><td>2007-04-29</td><td></td></tr> <tr><td></td><td>158</td><td>SUGGEST</td><td><p>It’s confusing to have AdminController referenced on this page (in Chapter 11) after not having been mentioned for literally several chapters (since Chapter 6). I found myself wondering whether, like ApplicationController, it was a default class. It’s not listed in the Index either which makes it even more difficult to recall where it was first introduced.<br /> A simple reference back to the chapter and page number(s) in which the AdminController was developed would greatly improve the flow of this chapter.<br /> (It’s literally the <em>only</em> confusing part of this otherwise outstandingly readable book, thus far.)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>181</td><td>TYPO</td><td><p>The word “set” in the second paragraph on this page seems like a typo, and could/should be omitted. The sentence in question reads: “First, if we create a product with no attributes, set we’ll expect it to be invalid and for there to be an error associated with each field.”</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>329</td><td></td><td>SUGGEST</td><td><p>The table with Declaration, Foreign Key, Target Class, Target Table should lead with the attribute name. I’m pretty sure I understand the phrase: “The parent class name is assumed to be the mixed-case singular form of the<br /> attribute name” but putting it as part of the example would help me.</p> <p>(Dave: I changed the column headings to make it clearer)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>493</td><td>OK</td><td><p>The ‘begin’ is missing from the rescue block at the top of page 493 on how to update multiple models. The begin should be before the line “Product.transaction”</p> <p>(dave: Actually, it’s OK as it stands…)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>158</td><td>OK</td><td><p>Rails 1.2.2 complains:</p> <p>../application.rb:xx: warning: Object#id will be deprecated; use Objectt#object_id</p> <p>with this line of code in the def authorize method in the application.rb file:</p> <p>unless User.find_by_id(session[:user_id])</p> <p>In addition to the compile warning, the authentication behavior is also broken for some strange reason.</p> <p>Replacing with something like:</p> <p>unless User.find(:first, :conditions => [“id = ?”, session[:user_id]])</p> <p>makes the compiler happy and fixes the authentication behavior.</p> <p>(Dave says: this seems to work find here with Ruby 1.8.6 and Rails 1.2.3)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td></td><td>127</td><td>SUGGEST</td><td><p>The implementation of hidden_div_if only outputs an open div tag, leaving a template that’s not well-formed, which feels wrong. It’s also tied to div element. Perhaps a nicer helper implementation, based on content_tag could be something like:</p> <p>def hidden_tag_if(name, content, condition, attributes = {})<br /> if condition<br /> attributes[“style”] = “display:none”<br /> end<br /> content_tag_string(name, content, attributes)<br /> end</p> <p>(Dave says: good idea)</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>421</td><td></td><td>ERROR</td><td><p>On page 423, the third assert_generates statement should be:<br /> assert_generates(“/store/add_to_cart/1”, { :controller => “store”, :action => “add_to_cart”, :id => “1”, :name => “dave” }, {}, { :name => “dave”})</p> <p>because the hash :name => “dave” is the ‘extras’ parameter and not defaults.</p> </td><td>2007-05-03</td><td></td></tr> <tr><td>424</td><td></td><td>TYPO</td><td><p>On page 424,<br /> assert_routing(path, options, defaults={}, extras={}, message=nil)<br /> instead of<br /> assert_routing(options, path, defaults={}, extras={}, message=nil)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>98</td><td>SUGGEST</td><td><p>It might pay to mention that Cart.initialize is not called again if it exists in the database. My first instantiation was incorrect (<code>items not established) and, as such, each time I tried to run the app I was trying to operate on a null </code>items reference … even after I’d fixed the error in initialize. The bug doesn’t go away until a delete from sessions statement is executed manually.</p> <p>FYI, I caused this error by initially naming the method initialise (note the ‘s’). I had hoped Ruby would be clever enough to do i18n, given that it knows how to pluralise. :)</p> <p>(Dave says: indeed, this is a situation that has to be dealt with. However, I think I’d like to deal with it in three pages time).</p> </td><td>2007-04-30</td><td></td></tr> <tr><td>259</td><td></td><td>TYPO</td><td><p>“namelist> script/generate model person” i think it the correct one is “namelist> ruby script/generate model person”.</p> <p>(Dave says: on a Windows box, yes)</p> </td><td>2007-05-02</td><td></td></tr> <tr><td>321</td><td></td><td>TYPO</td><td><p>i think the text “p res” should be “put res”</p> <p>(Dave: no—p is correct)</p> </td><td>2007-05-03</td><td></td></tr> <tr><td></td><td>374</td><td>OK</td><td><p>I’ve tried 6 ways from Sunday to get the generalized encryption and decryption handler running, but I cannot get it to work, even if I type it in exactly as you describe and run it vanilla.</p> <p>FYI… Why do I have to type in a PDF page number when I’m reporting an error in the paper book?!</p> <p>(Dave says: 1. Have you tried downloading the code and running that? I just tried, and it correctly encrypts the name and email in the database.</p> <p>2. You don’t If you have the PDF type its page number, If you have the paper book, type that)</p> </td><td>2007-05-06</td><td></td></tr> <tr><td></td><td>422</td><td>SUGGEST</td><td><p>Whilst the book talks a lot about REST, I couldn’t find any mention of what you need to make a REST <strong>client</strong>. After some searching on the Internet, it turns out the magic words are “ActiveResource”. It’s not properly released as a gem yet, but currently the book seems to give a complete silence about how to write REST clients.</p> <p>The REST server-side is covered in detail in pages 407-422; perhaps ActiveResource is worth a mention at the end of this.</p> <p>Also, at the top of page 583 it says: “For new applications where you aren’t constrained by external interfaces, you might want to consider using a lighter-weight REST approach”. But of course this won’t work unless you have a way to write a corresponding client.</p> <p>This omission is a shame, since the client side for SOAP/XMLRPC services <strong>is</strong> covered, albeit briefly, on page 597.</p> <p>(Dave says: Rails doesn’t yet have a complete client-side story. ActiveResource is way too volatile to document on paper, so I’m having to punt on it)</p> </td><td>2007-05-06</td><td></td></tr> <tr><td>355</td><td></td><td>TYPO</td><td><p>acts_as_list :scope => parent<br /> should be<br /> acts_as_list :scope => :parent</p> </td><td>2007-05-15</td><td></td></tr> <tr><td>714</td><td></td><td>OK</td><td><p>The last page of the index seems to contain a number of incorrect indexed pages, notably: “Windows tab completion, 36n” and “Williams, Nic, 290n” (note ‘n’ suffix.)</p> <p>(Dave says: ‘n’ is a convention in indexes. It means (in footnote))</p> </td><td>2007-05-07</td><td></td></tr> <tr><td></td><td>79</td><td>OK</td><td><p>I was following along and went to download the images and stylesheet referenced on the page (down in the footer), it seems those don’t exist online (for any of the depot versions online). I would really like to get them to follow along better.</p> <p>(Dave says: they seem to work for me…)</p> </td><td>2007-05-15</td><td></td></tr> <tr><td>19</td><td></td><td>TYPO</td><td><p>At the end of the first paragraph, there is a missing page number/link (shown as ??) in the sentence “The sidebar on page ?? describes another way of installing the full API documentation.”</p> <p>(In fact, the referenced sidebar has been deleted, as the underlying mechanism is broken in Rails 1.2.3)</p> </td><td>2007-05-09</td><td></td></tr> <tr><td>188</td><td>181</td><td>TYPO</td><td><p>Reads: “First, if we create a product with no attributes, set we’ll…”<br /> There is a comma in between attributes and set that shouldn’t be there.</p> </td><td>2007-05-15</td><td></td></tr> <tr><td>155</td><td></td><td>TYPO</td><td><p>In 11.1. the instruction to create the user model is typed out like this:</p> <p>depot> script/generate model user name:string hashed_password:string salt:string</p> <p>It should say<br /> depot> ruby script/generate model user name:string hashed_password:string salt:string</p> <p>Granted, at this point in time most people should know how to use it though :)</p> <p>(Dave says: by this time, most readers should have switched to a Unix-based platform, where the ‘ruby’ isn’t needed :)</p> </td><td>2007-05-15</td><td></td></tr> <tr><td>97</td><td></td><td>TYPO</td><td><p>"We</p> </td><td>2007-05-15</td><td></td></tr> <tr><td>103</td><td></td><td>TYPO</td><td><p>In 1st paragraph, 3rd, 4th and 5th sentences all seem to be missing a period at the end. They should be something like:</p> <p>The number can contain a level of precision using the :precision key; default is 2. The currency type can be set using the :unit key; default is “$”. The unit separator can be set using the :separator key; default is “.”.</p> </td><td>2007-05-15</td><td></td></tr> <tr><td></td><td>689</td><td>SUGGEST</td><td><p>I’d love to see a more complete Index to the boot, for example I was trying to find stuff about “Footers” but it’s not in the index, yet it’s talked about on page 505, among others.</p> <p>Indexing every unique word would be great!</p> <p>(Dave says: footers is a definite omission. The easiest way to search for arbitrary words is in the PDF)</p> </td><td>2007-05-20</td><td></td></tr> <tr><td>130</td><td>121</td><td>OK</td><td><p>The final sentence in the first paragraph — although comprehensible on the second reading — should be toned-down from “nerd speak” to something less technical. It currently references a particular</p> <div> <p>(the angle brackets are horrible!) and uses a CSS operator as a verb. Weird.</p> </td><td>2007-05-20</td><td></td></tr> <tr><td></td><td>79</td><td>OK</td><td><p>in depot_c/db/migrate/003_add_test_data.rb:</p> <p>In the text of the description of Pragmatic Version Control, text starting with the apostrophe in “it’s” and ending with “project” is italicized while the rest of the description text code is not.</p> <p>(Dave says: our syntax highlighter is easily confused… :)</p> </td><td>2007-05-20</td><td></td></tr> <tr><td></td><td>79</td><td>SUGGEST</td><td><p>in depot_c/db/migrate/003_add_test_data.rb the down migration deletes all records from the table. Would it not be better practice to explicitly remove just the records added in the up migration?</p> <p>(Dave says: in my experience, no. When I reset the database, I want to reset to a standard state, and get rid of all the crud I may have accumulated. Of course you’re free to take the other approach)</p> </td><td>2007-05-20</td><td></td></tr> <tr><td>155</td><td>147</td><td>TYPO</td><td><p>depot> script/generate model user name:string hashed_password:string salt:string</p> <p>should read:</p> <p>depot> ruby script/generate model user name:string hashed_password:string salt:string</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>253</td><td></td><td>OK</td><td><p>ActiveSupport does not seem to extends Time.to_s but rather Time.to_formatted_s</p> <p>(dave saysL klass.send(:alias_method, :to_s, :to_formatted_s) )</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>568</td><td></td><td>ERROR</td><td><p>server_settings has been renamed smtp_settings for Mailers</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>132</td><td>123</td><td>SUGGEST</td><td><p>The bullet points that highlight which lines have changed in file ‘cart.rb’ should also include one more two lines down at the line ‘current_item’ (before the final ‘end’ statement).</p> <p>This is a new line to the file at this stage of development.</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>88</td><td>79</td><td>OK</td><td><p>The footer refers to the following two items that appear to be missing from the companion website:</p> <p>11. “media.pragprog.com/titles/rails2/code/depot_c/public/images”<br /> 12. “media.pragprog.com/titles/rails2/code/depot_c/public/stylesheets/depot.css”</p> <p>(Dave says:seems to work fine from here)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>181</td><td>173</td><td>TYPO</td><td><p>The simulated terminal prompt says ‘dept>’ instead of ‘depot>’</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>224</td><td></td><td>OK</td><td><p>When running the benchmark, I had to comment out: “,except => :empty_cart” in store_controller.rb<br /> otherwise it would always raise an error stating that: “undefined local variable or method ‘except’ for StoreController:Class (NameError)”.</p> <p>(Dave says: the code has :except already)</p> <p>Also I noticed that in the book, the benchmark time took 3.840708 seconds, and the assertion that it should take less than 3 seconds was still valid.</p> <p>For a comparison, on my C2D E6300 with InstantRails 1.7, the same test took 43 seconds. The G5 and RoR implementation on Mac seem much better!</p> <p>(Dave says: the time reported for the test includes setup and teardown)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>107</td><td></td><td>OK</td><td><p>The comment in the following class can be quite misleading<br /> class ApplicationController < ActionController::Base<br /> # Pick unique cookie name to distinguish our session data from others’<br /> session :session_key => ‘_depot_session_id’<br /> end</p> <p>The comment may be taken to suggest that the cookie differentiates sessions within the application! while the cookie name differentiates only between ‘applications’.</p> <p>I suggest therefore that the comment be:<br /> # Pick a cookie name specific to this application (to allow the user to run different apps on same server).</p> <p>Raul</p> </td><td>2007-07-19</td><td></td></tr> <tr><td>210</td><td>203</td><td>TYPO</td><td><p>The description of :not(sel) reads “Selects all node that are” (note missing trailing ‘s’ at ‘node’).</p> </td><td>2007-08-08</td><td></td></tr> <tr><td></td><td>522</td><td>SUGGEST</td><td><p>“The Search Example” employs the Streamline plug-in but the book has not walked the reader through HOW to install plug-ins or that this plug-in requires code in a helper file and controller. It could save a beginner many hours in trying to get the sample code to work (e.g., as happened with myself).</p> <p>(Dave says: it is already installed in the downloadable code. We also show the code for the single method used from it, so you could enter that as well)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>348</td><td></td><td>OK</td><td><p>In the 6th paragraph, shouldn’t “Let�s start with the three tables that contain the three types of resource.” really be “Let�s start with the three tables that contain the three types of resources.”?</p> <p>(Dave says: I believe not)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>325</td><td>323</td><td>ERROR</td><td><p>When creating the following index:</p> <p>“add_index :categories_products, [:product_id, :category_id]”</p> <p>Isn’t the “:unique => true” option missing, given you mention in the next page that such index should be unique?</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>677</td><td>680</td><td>TYPO</td><td><p>In the middle of the page (215) where you are declaring the class StoreController; I happen to notice that in the Appendix C, page 680 defines the class as OrderController. Which one is right?</p> <p>(Dave says: The code in the appendix is wrong. It should be StoreController throughout.)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>447</td><td>446</td><td>SUGGEST</td><td><p>It’s written: “In particular, every object must be serializable, and if you store models, you need a model declaration in your controller.”</p> <p>This is the first time you mention model declarations in this book, and it appears that model declarations are deprecated in 1.2 looking at actionpack-1.13.3/lib/action_controller/deprecated_dependencies.rb</p> <p>Perhaps this is no longer necessary to include models in the flash or session?</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>423</td><td>421</td><td>TYPO</td><td><p>“The <em>default</em> parameter is unused.” -> “The <em>defaults</em> parameter is unused.”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>278</td><td>275</td><td>ERROR</td><td><p>On pg. 278 you name your constraint thusly: fk_line_item_products and fk_line_item_orders. The general form of this is fk<em><span style="text-align:left;">from_table></span></em><to_table>.<br /> When you turn this into a helper method further down on pg. 278 and again on pg. 279 you have the following assignment statement:<br /> constraint_name = “fk<em>#{from_table}</em>#{from_column}”.<br /> I think the #{from_column} should actually be #{to_table}.</p> <p>(Dave says: good catch)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>111</td><td></td><td>OK</td><td><p>the screenshot of the error reports “No Method Error in Store” but actually it should be “no Method Error in StoreController”</p> <p>(Dave says: different versions of Rails change the message)</p> </td><td>2007-07-19</td><td></td></tr> <tr><td>627</td><td>629</td><td>TYPO</td><td><p>The ruby code to clear out the sessions uses the wrong method…should be ‘delete_all’ not ‘delete’. (‘delete_all’ takes conditions, while ‘delete’ takes id only)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>358</td><td>356</td><td>TYPO</td><td><p>“Add the option :counter_cache => true to<br /> the acts_as_tree declaration, and add the column categories_count to your table.” is wrong, counter cache is stored in children_count</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>2</td><td></td><td>TYPO</td><td><p>“the code is this book” should be “the code in this book”</p> <p>“may not longer run” should be “may no longer run”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>350</td><td></td><td>ERROR</td><td><p>In the example for the Catalog->Resource polymorphic association, the downloaded file ‘polymorphic.rb’ has 2 errors in the final ‘else branch’. I reproduce the code adding a comment showing the corrections on the lines where the errors occurr:<br /> ——-<br /> a = Sound.new(:content => “ding!”)<br /> c = CatalogEntry.new(:name => ‘Sound One’, :acquired_at => Time.now)<br /> c.resource = a<br /> c.save!</p> <p>c = CatalogEntry.find 2 # id should be 1 (not 2)<br /> p c.resource<br /> a = Article.find :first # resource is Sound (not ‘Article’)<br /> p a.catalog_entry<br /> ——-</p> <p>With the indicated corrections, code runs well.</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>301</td><td>299</td><td>TYPO</td><td><p>Middle of the page:</p> <p>still_more = Order.find(:all, :conditions => :params[:order])</p> <p>I believe ‘:params’ should be ‘params’ without the leading colon.</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>278</td><td></td><td>TYPO</td><td><p>when it writes native sql to add a foreign key constraint in the migration in a custom class method, we have only one “from_table” parameter to that method. But the problem is that in the entire native sql we have that from_table string one time in the singular form and another time in the plural form. We have “line_item” and “line_items”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>540</td><td>540</td><td>TYPO</td><td><p>In the code at the end of the section “Degrade to Different URLs,” the first line of the definition for send_email_no_ajax should begin with “actually_send_email” instead of “acutally_send_email.”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td></td><td>124</td><td>SUGGEST</td><td><p>On page 116, when _cart and _cart_item partials are introduced, we’re treated to a lecture on brittle, ugly, hard to maintain programs using global variables (in this case, it’s about accessing <code>cart). But all these considerations are forgotten on page 124 when we use </code>current_item in _cart_item without a care in the world. Should the considerations above apply, the “current_item” should be sent as a parameter to _cart and from there to _cart_item. I don’t know enough Rails at this point to know if this is even possible, but some coherence is needed IMHO.</p> <p>(Dave says: indeed it should… :)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>377</td><td>374</td><td>TYPO</td><td><p>In the 3rd paragraph on Callback Objects it reads “.. we might want to share<br /> our normalize_credit_card_number method across multiple methods.” Should probably read “…. across multiple models.”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>136</td><td></td><td>SUGGEST</td><td><p>“And, finally, we need to remove the flash message that we used to display<br /> when the user empties a cart,” is confusing. The book has just spent several pages implementing the fade effect, which creates the visual impression of a ‘flash.’ The fade effect is even described as a ‘flash’ on page 131. So on page 136, I was completely confused when “flash” started meaning the Rails flash mechanism again. I even spent ten minutes trying to figure out when we hadded the fade effect to the Empty Cart button! But, of course, we hadn’t!</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>136</td><td></td><td>OK</td><td><p>To improve clarity of the paragraph, please consider rewording the sentence: “That means we�ll continue to display the flash message saying the cart is empty even as we display a cart in the sidebar.” Consider alternative: “That means, if we fail to remove it, we’ll continue…” Consider alternative: “That means we would [erroneously] continue…” Maybe that whole paragraph should be reviewed.</p> </td><td>2007-07-19</td><td></td></tr> <tr><td>459</td><td>458</td><td>TYPO</td><td><p>At the end of the page you wrote “Put your sweeper code in app/models.”. AFAIK the sweepers should be in /app/sweepers</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>442</td><td></td><td>OK</td><td><p>“session :except =>”, I think this should be “session :off, :except =>” much like the other three examples.</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>334</td><td></td><td>OK</td><td><p>at line 10 it says:“The following code might be used to specify that the line items for an order are<br /> to be sorted in order of quantity (smallest quantity first).”<br /> The fact is that after this the code that follows use: has_many :line_items,<br /> :order => “quantity, unit_price DESC”</p> <p>…here the keyword used is “DESC” but beacause it said that the order of line items is by quantity, with smallest quantities first, it shouldn’t be used any keyword so the order will be by default ascending.</p> <p>(Dave says: the DESC applies to the unit_price. Quantity will be ascending)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>344</td><td>342</td><td>TYPO</td><td><p>When it defines the class “Employee” in the code listing, shouldn’t be the association declaration like the following?<br /> belongs_to :boss, :class_name => “Manager”, :foreign_key => :reports_to</p> <p>…insted of</p> <p>belongs_to :boss, :class_name => “Employee”, :foreign_key => :reports_to</p> <p>The “:class_name” option should report the class Manager instead of Employee</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>535</td><td>535</td><td>TYPO</td><td><p>In the ‘remote_function’ helper code sample, there is a missing ‘%>’ (Erb closing sequence), so:</p> <table> <p><% for email in @emails %></p> <tr ondblclick="<%= remote_function(:update => 'email_body', :url => {:action => 'get_email', :id => email})"> <td> <p><%= email.id %></p> </td> <td> <p><%= email.body %></p> </td> <p>…</p> <p>Should really be:</p> <table> <p><% for email in @emails %></p> <tr ondblclick="<%= remote_function(:update => 'email_body', :url => {:action => 'get_email', :id => email}) %>"> <td> <p><%= email.id %></p> </td> <td> <p><%= email.body %></p> </td> <p>…</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>321</td><td>319</td><td>ERROR</td><td><p>“Have a look at the Rails API documentation for AbstractAdapter for a full list of the low-level connection methods available.”<br /> should read:<br /> “Have a look at the Rails API documentation on module ActiveRecord::ConnectionAdapters::DatabaseStatements for a full list of the low-level connection methods available.”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>50</td><td></td><td>SUGGEST</td><td><p>On my W2K PC, instead of producing the correct time zone, such as CDT or PST, I get, for my PST zone, –0700:</p> <p>“It is now Sun Jul 01 17:15:15 –0700 2007”</p> <p>What is the correct code to display the three-letter time zone?</p> <p>(Dave says: No idea :) This is coming straight from Ruby on Windows)</p> </td><td>2007-08-03</td><td></td></tr> <tr><td>497</td><td>497</td><td>OK</td><td><p>After creating the BuilderHelper module (app/helpers/builder_helper.rb), it needs to be included in ApplicationHelper. I don’t see in the text where this is mentioned, nor could I find a code sample that included this. In detail, app/helpers/application_helper.rb should have ‘include BuilderHelper’ within the ApplicationHelper module definition.</p> <p>(Dave says: In this case, the controller is called BuilderController, and it automatically loads BuilderHelper. For different controllers, we’ve previously discussed the ‘helper’ directive)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td></td><td>25</td><td>DEFER</td><td><p>There is now a binary distribution for Linux called LinRails located at linrails.thembid.com that includes all the necessary tools to get started that could be mentioned</p> <p>(Dave says: I’ll investigate it for the next edition)</p> </td><td></td><td></td></tr> <tr><td>440</td><td>439</td><td>ERROR</td><td><p>at the end of this page it says that “session_store” is an attribute of ActiveRecord::Base. Immediately after the example shows:<br /> Rails::Initializer.run do |config|<br /> config.action_controller.session_store = CGI::Session::PStore<br /> config.action_controller.session_options[:tmpdir] = “/Users/dave/tmp”<br /> config.action_controller.session_options[:prefix] = “myapp_session_”</p> <ol> <li>… </li> </ol> <p>So i think it is an attribute that deals with action controller</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>109</td><td></td><td>OK</td><td><p>Let’s make it happy by writing a trivial<br /> template (we’ll tart it up in a minute). Should be start it up</p> <p>(Dave says: tart is correct)</p> </td><td>2007-07-19</td><td></td></tr> <tr><td>626</td><td>628</td><td>TYPO</td><td><p>“you need a lower-level information” should be “you need lower-level information”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>35</td><td></td><td>SUGGEST</td><td><p>The page says, “There are at least two package management systems for OS X.” The text then goes on to describe only one of them: MacPorts. I assume the other package is Fink, which has even more packages than MacPorts. It deserves at least a mention in the book.</p> <p>(Dave says: I’ve had problems with fink, and none with MacPorts. For that reason, I recommend ports to folks)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>687</td><td></td><td>DEFER</td><td><p>AR::Base#quote ( #quote_value in Edge/2.0) not listed in index. Should be either listed under “q” or under “Active Record” entries</p> <p>(Dave says: that’ll change a lot of pagination, so it’ll have to be deferred)</p> </td><td></td><td></td></tr> <tr><td>246</td><td>241</td><td>TYPO</td><td><p>The breakpointer parameter, “-s”, is split across two lines. Word breaking at the hyphen should not be allowed here.</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>195</td><td>188</td><td>SUGGEST</td><td><p>“The code is on the next page.” I guess that would be on the paper edition, or on a older edition? On the PDF the code is right under that line, but there IS code on the next page, which I don’t think was the one referred to. My point is: this kind of statement is more confusing than helpful (and more so in a book that has pagination differences between the paper and the electronic version).</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>201</td><td></td><td>OK</td><td><p>In the code near the bottom of the page in the test_index_with_user functional test method, you use a symbol for the session key. It seems that Rails (at least as of 1.2.3) requires you to use strings (not symbols) for session keys.</p> <p>(Dave says: it seems to run OK here with 1.2.3)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>155</td><td>178</td><td>SUGGEST</td><td><p>Mike’s ls lists the test/unit/ subdirectory in unsorted order: order_test.rb comes before line_item_test.rb. Is this intended?</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>1</td><td></td><td>DEFER</td><td><p>I would like to have more description on web services clients and more explanations on what is going on the various parts of the initial app tutorial</p> </td><td>2007-08-03</td><td></td></tr> <tr><td>165</td><td></td><td>OK</td><td><p>I find this line “@total.orders = Order.count” pretty puzzling. Where does the “count” method come from? I checked ActiveRecord::Base looking for it, but isn’t there. Could you explain this better? Thanks</p> </td><td>2007-07-19</td><td></td></tr> <tr><td></td><td>624</td><td>OK</td><td><p>Should note that you need to install gem for mongrel_cluster first.</p> <p>(Dave says: It’s on the list on the previous page)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>472</td><td>472</td><td>ERROR</td><td><p>Under title “Sharing Helpers”, it is written (the question marks is mine, to indicate the problem):<br /> —-<br /> You can include an already-loaded class (??) as a helper by giving its name to the helper declaration:</p> <p>class ParticularController < ApplicationController<br /> helper DateFormat<br /> —-</p> <p>I was wondering how it was possible “to include a class”, and after reading the code of the method (in action_controllers/helper.rb) I think that the writer meant “module” and not “class”. In other words, one can include a helper module writing either:</p> <p>helper :date_format # name of the file with module<br /> or<br /> helper DateFormat # name of the module</p> <p>In either case, the code of the helper method ends up including a module (to the View); a class name cannot be passed to it (I think!).</p> </td><td>2007-08-08</td><td></td></tr> <tr><td></td><td>210</td><td>OK</td><td><p>In the example creating a Domain-Specific Language, there is this line:<br /> def user.has_a_cart_containing(*products)</p> <p>I realize this book isn’t meant to be a Ruby tutorial, but what does the “star” operator do here? I’ve looked around online and in the pickaxe book, but can’t figure out what the purpose of the “*” is.</p> <p>(Dave says: it collects all arguments passed in into a single array)</p> </td><td>2007-08-03</td><td></td></tr> <tr><td>369</td><td></td><td>SUGGEST</td><td><p>In the example code for validates_exclusion_of you give an example of :gender limited to male or female. In contemporary thought, this physical characteristic (male or female) would be aptly named :sex. Gender is widely considered a much broader, elastic, and performative category.</p> <p>(Dave says: as is :sex… :)</p> </td><td>2007-08-03</td><td></td></tr> <tr><td>273</td><td>270</td><td>ERROR</td><td><p>regarding the default name of the index created, it should say “index_table_on_column” instead of “table_column_index”</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>203</td><td>196</td><td>ERROR</td><td><p>Near the bottom, just above the emboldened word “Assertions” in the line: xhr(:get, :add_to_cart. :id => 11)</p> <p>Shouldn’t that be a “post” method as it is changing the state by adding and item to the cart?</p> </td><td>2007-08-08</td><td></td></tr> <tr><td></td><td>111</td><td>OK</td><td><p>Hi I think I found an error in your great book:</p> <p>The cart member function total_price does not take the amount of items into account. For example in the image on page 111 you can only see a sum of 173, whereas the total sum should be way higher.</p> <p>I am referring to the printing of the book P3.0 from May 21, 2007 which is not available for selection above.</p> <p>Sebastian</p> <p>(Dave says: have a look at the definition of cart_item.price… :)</p> </td><td>2007-08-08</td><td></td></tr> <tr><td>623</td><td></td><td>DEFER</td><td><p>With Capistrano 2.0 out, it appears that the line “cap —apply-to /local/project/path [applicationname]” is out of date, perhaps it should just read “capify /local/project/path”?</p> <p>(Dave says: I’ll have to cover cap2 in the next edition)</p> </td><td></td><td></td></tr> <tr><td>325</td><td>323</td><td>ERROR</td><td><p>add_index :categories_products, :category_id, :unique => true</p> <p>This should not be :unique => true as that would prevent a category from being joined to more than one product. The index of [:product_id, :category_id] as :unique => true is appropriate and is correct in my version of the pdf.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>150</td><td></td><td>OK</td><td><p>I found it weird at the first glance one thing: li.total_price = cart_item.price. Do you see? total_price and price. The reader presumably figures it out after a few seconds (after looking at the CartItem model, most probably), but anyways, it would worth a sentence to point out what that line actually does, and remember the user the existence of the price method in the CartItem model.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>130</td><td></td><td>SUGGEST</td><td><p>if you are having problems with the AJAX, make sure you are clicking the button and not the hyperlinked image (made via a link_to in a previous ‘extra stuff’ section).</p> </td><td></td><td></td></tr> <tr><td>307</td><td></td><td>OK</td><td><p>Regarding:<br /> :order<br /> Orders the result set (useful only with :group)</p> <p>This is also useful when :group is not used. Perhaps the parenthetical was intended to be applied to the :having option just below it? That would then make sense.</p> <p>(Dave says: it’s in the section on column statistics, where :order is pretty meaningless)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>267</td><td></td><td>SUGGEST</td><td><p>Hi!</p> <p>You should include “:interval” type… it seems to be supported as a data type on migrations. I just used it in one of my projects.</p> </td><td></td><td></td></tr> <tr><td></td><td>410</td><td>OK</td><td><p>In either my code or the code examples download from the site<br /> get the error:<br /> Couldn’t find Article with ID=index<br /> If it is the versions of Ruby (1.8.6), Rails (1.2.3), gem (0.9.2), please let me know. The error occurs with restful and restful2.<br /> Would be very helpful to search all the erratum for changes.</p> <p>(Dave says: I bet you’re fetching the URL articles/index)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>370</td><td>TYPO</td><td><p>This is really picking the fly poop out of the pepper, but:</p> <p>“onlyif” near top pf page should be “only if”</p> <p>Might read better as “this option only works if…”<br /> rather than “this option works only if…”</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>210</td><td></td><td>OK</td><td><p>Under the section “numeric parameter to the nth-xxx selector,” the description for an + d and the explanation for the subsequent example, 3n + 1, contradict each other. Given an + d should be dth node in groups of a, I would expect 3n + 1 not to be every third node but rather the first, fourth, seventh and the like nodes. Every third node would be 3n + 0 or 3n.</p> <p>(Dave says: I believe the counting starts at 1, and the book is correct)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>308</td><td></td><td>ERROR</td><td><p>The :join in “(just like the :join parameter to find)”, should be :joins.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>191</td><td>184</td><td>TYPO</td><td><p>In the case of the Rails-generated fixture, the rows are named “one” and “two”. (not “first” and “another” — listing has it right, text has it wrong.)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>577</td><td></td><td>SUGGEST</td><td><p>In note 2, you refer that “at the time of writing, there’s a minor bug in Rails. If a message has attachments”.</p> <p>It would be very useful when such mentions are made, to refer (or even “link” to) the bug number in the Rails’ Trac system, so that the book feels up-to-date for longer!</p> <p>For instance, the bug mentioned in page is already fixed in:<br /> h t t p://dev.rubyonrails.org/ticket/3332</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>552</td><td></td><td>TYPO</td><td><p>The JavaScript in the last example on the page refers to AJAX.Request, which should be Ajax.Request.</p> <p>(Dave says: it looks as if a search and replace went wild: there are half-a-dozen of these in the chapter)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>621</td><td></td><td>SUGGEST</td><td><p>“CREATE DATABASE myapplication;” should rather be “CREATE DATABASE myapplication CHARACTER SET utf8;” as suggested on page 258.</p> <p>(Dave says: if you want a Unicode application…)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>623</td><td>ERROR</td><td><p>When setting up the deployment machine, the text says to install termios twice, once from MacPorts, and a second time from gem install.</p> </td><td></td><td></td></tr> <tr><td></td><td>518</td><td>TYPO</td><td><p>Near the top, it states that the Deployment and Production chapter starts on page 458 when that chapter actually starts on page 615</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>563</td><td>TYPO</td><td><p>The bottom paragraph is missing a period or contains “run on” sentences, or something. I got the point,(after reading it 10 times) but the grammatical structure is flawed somehow.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>478</td><td></td><td>DEFER</td><td><p>Now (with the next rails 2.0 in mind) it is better to use the rails will_paginate plugin to do pagination in rails. It is much powerful.</p> </td><td></td><td></td></tr> <tr><td>581</td><td></td><td>TYPO</td><td><p>ActionMailer::base.deliveries should really be ActionMailer::Base.deliveries</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>41</td><td>319</td><td>SUGGEST</td><td><p>IBM provides a common Ruby driver/adapter for DB2 LUW (Linux, UNIX, Windows), zOS, i5 and Informix Dynamic Server. The homepage for this is rubyforge.org/projects/rubyibm/. A gem is also available for easy installation</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>356</td><td></td><td>DEFER</td><td><p>Trying to use the acts_as_list function, I have problems figuring out how to insert an item at a certain position in the list.<br /> I have found out that there is the method insert_at(position), but I’m still looking for how to actually use it.<br /> It would be nice to have that explained in that section in the book!</p> </td><td></td><td></td></tr> <tr><td></td><td>262</td><td>SUGGEST</td><td><p>Change the last sentence in the first paragraph:<br /> After each migration finishes, the |version| entry in the |schema_info| table is updated to the migration’s sequence number.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>90</td><td></td><td>SUGGEST</td><td><p>This actually appears on both page 89 and 90 during the discussion of how to add style sheets to the admin.rhtml file. There is talk of adding the <!DOCTYPE …> definition to said file, but this doesn’t seem to be necessary, as the template that comes with the current version (as of September 12, 2007) of Rails already has the <!DOCTYPE …> in place, as well as the required xmlns, xml:lang, and lang properties of the</p> <html> <p>tag for XHTML 1.0 compliance. It’s a small thing, but I thought I’d mention it anyway. :) Cheers! I’m really enjoying this book!</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>546</td><td></td><td>ERROR</td><td><p>The second to last sentence does not correspond to the Regexp, in that the example code looks only for matches at the start of the name. Removing the ‘^’ from the Regexp will produce matches anywhere in the name.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>268</td><td></td><td>ERROR</td><td><p>The footnote states, “simply make it a datetime and name it created_at”, but the majority of the book has “timestamp” — do a search on “created_at”. Which is it, or doesn’t it matter?</p> </td><td></td><td></td></tr> <tr><td>420</td><td>419</td><td>ERROR</td><td><p>I think find_article will fail if there is no article number as the redirect_to doesn’t return so Article.find(nil) will get called resulting in a RecordNotFound exception. At least that’s what happened to me.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>555</td><td></td><td>SUGGEST</td><td><p>Within the inplace_demo.rhtml, the function ‘user_columns’ requires the relevance_extensions plugin; some mention of this dependency might be helpful</p> </td><td></td><td></td></tr> <tr><td>176</td><td></td><td>OK</td><td><p>First line depot> curl … command curl does not work under command line of Windows OS?. Only Unix?</p> <p>(Dave says: yes, it’s only Unix. You don’t have to run it: it’s just there to show the output)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>89</td><td>DEFER</td><td><p>The doctype declaration on page 89 is incorrect. The first 2 lines must be followed by the tag that says: (I had to replace the http with hxxp to submit this Erratum)</p> <p><html xmlns=“hxxp://www.w3.org/1999/xhtml” xml:lang=“en” lang="en></p> <p>This is irrelevant because rails now adds this for us, but the book is incorrect.</p> <p>Throughout the Depot example, html image tags are displayed in the documents.In no location are the image tags provided with an html “alt” declaration. With the doctype declaration on page 89, lack of “alt” tags causes the document to fail validation as Transitional xhtml.</p> <p>The tags look like this:</p> <p><img src="<%= product.image_url %>" /></p> <p>They should look like this:</p> <p><img src="<%= product.image_url %>" alt=“Picture of <%= h(product.title)%>” /></p> <p>In fact, a column should probably be added with the alt value if we are to be section 508 compliant.</p> <p>(Dave says: I agree 100%. However, because this would affect so many pages in the book, it’ll have to wait for the next full-content reprint [we normally submit just individua page corrections for reprints])</p> </td><td></td><td></td></tr> <tr><td></td><td>126</td><td>TYPO</td><td><p>right below the subtitle ‘Helper Methods’:<br /> Whenever we want to abstract some processing our of a view (any kind of view), we want to (—-> have to) write a helper method.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>628</td><td>SUGGEST</td><td><p>When rotating log files, it suggests that you “first copy the contents of the current log to a different file and then truncate it.” This seems both wasteful and prone to weird race conditions. Maybe I’m wrong, but I thought that the normal thing to do was to move the log file (which is harmless to a server that already has the file open) and then HUP the server (which causes the server to create a new log file with the original filename).</p> </td><td></td><td></td></tr> <tr><td></td><td>499</td><td>ERROR</td><td><p>There’s a bit of code that says:</p> <p>[code]<br /> <%= select_tag(:operator,<br /> options_for_select(%w{ + - * / },<br /> @params[:operator])) %><br /> [/code]</p> <p>Aside from the fact that <code>params is wrong, that third line is indented wrong. I spent quite a bit of time fighting a bug because </code>params[:operator] is meant to be an argument to options_for_select, but it’s indented as if it’s an argument to select_tag.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>144</td><td></td><td>OK</td><td><p>Fortunately, Rails makes this relatively painless. It provides us with a bunch<br /> of for m helper methods. These helpers interact with the controller and with</p> <p>The second line looks like it should say form_helper and not for m helper methods.</p> <p>(Dave says: I think this is a proble with your PDF viewer)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>146</td><td></td><td>OK</td><td><p>All these relationships can be confusing. It’s important to remember that Rails<br /> needs to know both the names and the values to use for the fields associated<br /> with a model. The combination of form_for and the various field-level helpers<br /> (such as text_field) give it this information. Figure 10.1, on the previous page,<br /> shows this process.</p> <p>Several places characters are missing.</p> <p>(Dave says: PDF viewer problem)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>149</td><td></td><td>OK</td><td><p>Joe Asks. . .<br /> Aren’t You Creating Duplicate Orders?<br /> Joe is concerned</p> <p>The characters are not showing up in my copy of the PFD<br /> I see<br /> Aren’t ou Creating uplicate rders?<br /> oe is concerned</p> <p>(Dave says: PDF viewer problem)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>709</td><td></td><td>SUGGEST</td><td><p>In the index, Single Table Inheritance is listed as “Single-Table Inheritance”, but in 2 other index entries, you’re saying “see Single Table Inheritance”.</p> <p>This is small, but when using search in Preview, I couldn’t find everything on the topic because I searched for “single table”. I guess this is just a minor vote for fixing consistency. :)</p> <p>(Dave says: let me fix this on the next major reprint)</p> </td><td></td><td></td></tr> <tr><td>621</td><td></td><td>TYPO</td><td><p>The first line of sudo gem install does not work I suspect a typo.</p> <p>(Dave says: it should be</p> <p>sudo gem install rake)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>67</td><td>SUGGEST</td><td><p>On page 67 and page 277 you explain and warn of an irreversible status with schema and migrations where you can get in a situation you cant step back or forward.</p> <p>You recommend “dropping a the entire database”.</p> <p>I am new to all this and while I am definitely “getting” all sorts of stuff by following along, doing and re-doing.. re-reading chapters etc. but….it would be nice to have a little bail out instructions here.</p> <p>How will i put it back together once I break it further? (is this dropping dangerous? lol)</p> <p>Guess I’ll go to my file manager, delete the mysql data base, create a new one of the same name, then hope upon hope that my schema, stuck at a higher version # wont error when I try to rake it back with to version 0 .. or do I delete the schema file too? (will it be regenerated?) tomnorian@yahoo.com (I am really enjoying the book (ordered the cookbook too) and Im finally getting a grasp on how a database app works while learning about rails in specific. tomnorian@yahoo.com</p> <p>(Dave says: in mysql, it’s “mysqladmin -u root drop store_development”)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>117</td><td></td><td>SUGGEST</td><td><p>even with these changes if you manually enter an invalid product id url where the product id starts with a valid id (e.g. …add_to_cart/4fffff where 4 is a valid product id) it will increment the count for the relevant product. since this section is talking about making the sample more robust I suggest you address this hole</p> </td><td></td><td></td></tr> <tr><td>291</td><td></td><td>ERROR</td><td><p>The name of the driver and adapter has been changed to ibm_db since now the same driver/adapter can be used with both Informix and DB2 databases</p> </td><td></td><td></td></tr> <tr><td>534</td><td></td><td>ERROR</td><td><p>in the example given for “periodically_call_remote” the third line is a condition where .innerHTML == “Unknown” which will cause this supposedly periodic function to only run once, for once the div is changed from “Unknown” the condition will fail.</p> </td><td></td><td></td></tr> <tr><td>534</td><td></td><td>OK</td><td><p>to keep the formatting consistent with other examples, the :url component of the example for “periodically_call_remote” should be given its own line.</p> <p>(Dave says: then I’d need parentheses)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>545</td><td></td><td>ERROR</td><td><p>under “auto_complete_field options”, in about the 2rd paragraph down, it says something about overriding the default server endpoint. this is in the optional section but in the previous section - “autocompletion” - the server endpoint (the :url option) - is specified. the non-optional section, the :url option should not be specified, at the very least, to show an example of how you can use autocomplete without the :url option.</p> </td><td></td><td></td></tr> <tr><td></td><td>509</td><td>ERROR</td><td><p>This is just a nit, but on the bottom of page 509, “article.title” should be “h(article.title)” to match “h(article.body)”.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>510</td><td>ERROR</td><td><p>It’s a nit, but “<code>request.remote_ip" should be "request.remote_ip". "</code>request” is deprecated.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>156</td><td></td><td>OK</td><td><p>The book speaks of a “Hashed password”, but technically, it is a “Hash of the password”. The point is that SHA1 is a cryptographically secure hash function and which creates a digest of a message and is irreversible by definition. The authentication mechanisms simply hash whatever a user enters as password using the same algorithm and compare both hashes, but the password is never obtained back from the hash.</p> <p>(Dave says: I don’t see the distinction. It’s like saying “Uppercased password ” (if that was a word), in that it simply implies the result of a transformation. I don’t believe I ever state the password is recovered from the hash)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>169</td><td></td><td>OK</td><td><p>In this code snippet it would be nice to comment that the :confirm option requires JavaScript enabled:</p> <li> <p><%= link_to “[X]”, { # link_to options<br /> :controller => ‘login’,<br /> :action => ‘delete_user’,<br /> :id => user},<br /> { # html options<br /> :method => :post,<br /> :confirm => “Really delete #{user.name}?”<br /> } %></p> </td><td>2007-11-02</td><td></td></tr> <tr><td>181</td><td></td><td>OK</td><td><p>It would be interesting to mention that when using accepts.xml ‘{ render :xml => @product.to_xml(:include => :orders) }’ there is no need to have an .xrml template. — The .to_xml block seems to override the template.</p> <p>(Dave says: It needs to template because of the “render” itself)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>399</td><td>OK</td><td><p>The footnote, although appropriately numbered ‘2’, just as the page of the book where “the DRY principle” is firstly mentioned and explained, is an obvious violation of the very principle it cares to repeat to translate. ;-)</p> <p>(Dave says: that’s really funny… I’m going to leave it in, just because repetition, although bad in code, is often good in books…)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td></td><td>422</td><td>TYPO</td><td><p>assert_routing: … the path generates the options … the options generate the path.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>249</td><td></td><td>SUGGEST</td><td><p>The paragraph below from p 249 seems unfinished. I added between [> <] my suggested completion for the sentence.</p> <p>The index_by method takes a collection and converts it into a hash where the values are the values from the original collection. The key referencing each value is determined by passing that element to the block [ > and returning from the block the value that is to be the key <].</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>320</td><td></td><td>OK</td><td><p>The text below is using the obsolescent ‘id’ attribute. Next version of the book should use ‘object_id’:</p> <p>Model objects redefine the Ruby id and hash methods to reference the model’s<br /> primary key</p> <p>(Dave says: ‘id’ is still there, though, so it is being redefined)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>368</td><td></td><td>ERROR</td><td><p>The documentation for validates_format_of says that it has an ‘:allow_nil’ option, but this doesn’t seem to be the case (it isn’t mentioned in the online API docs, and doesn’t seem to have any effect in rails 1.2.4.</p> </td><td></td><td></td></tr> <tr><td></td><td>494</td><td>TYPO</td><td><p>the labels for the fields <em>duplicate</em> the field names</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>622</td><td></td><td>ERROR</td><td><p>In the sentence at the bottom of the page you specify the wrong path for the production application:</p> <p>“In the Capistrano recipes that follow, the deployment path is set to /Library/ followed by the name of your application.”</p> <p>This should read “… /Library/Rails/ …”</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>599</td><td></td><td>SUGGEST</td><td><p>Seems manuals.rubonrails.com is not working?</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>54</td><td></td><td>SUGGEST</td><td><p>We can update Rails for each project with the ‘gem update rails —include-dependencies’ command. ‘gem cleanup’ then removes the old version.</p> <p>Running ‘rake rails:update’ will fail because Rails is now of a newer version. Editing the environment variable<br /> RAILS_GEM_VERSION to the new Rails version (e.g. 1.2.5) in the ‘environment.rb’ file for the project will remedy the ‘rake rails:update’ error message.</p> </td><td></td><td></td></tr> <tr><td>543</td><td></td><td>ERROR</td><td><p>The code presented in this page ‘auto_complete_demo.rhtml’ does work in Safari, but not in Mozilla based browser like FireFox or Camino. Additionally, the code presented seems unnecessarily complex.</p> <p>A little investigation seems to indicate that an easier + portable solution is to use a ‘text_field_with_auto_complete’ macro and pass the tokens delimiter. I have tried this one on Mozilla based browsers and it does work.</p> <p>BTW: ‘text_field_with_auto_complete’ is how Autocomplete is presented in the Rails recipes book, or in the scriptaculous demos.</p> </td><td></td><td></td></tr> <tr><td>362</td><td></td><td>OK</td><td><p>The code demonstrating the proper use of counter_cache (e1/ar/counters.rb) does not work as expected. The second printing of the in-memory value of the counter:<br /> puts “In memory size = #{product.line_items.size}”<br /> should print 1, but instead prints 0.</p> <p>I’m running Ruby 1.8.4, Rails 1.2.3 on Linux Fedora Core 4. I <strong>think</strong> the problem is a rails bug, and not the code. See the rails dev site: dev.rubyonrails.org/ticket/5050</p> <p>(Dave says: I guess we’ll wait for Rails to catch up…)</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>84</td><td>767</td><td>SUGGEST</td><td><p>We set a lower limit for the price, which we validate. We never check if we’re out of bounds on the <strong>upper</strong> limit which has been enforced when we created the “price” column of 8 digits 2 decimal points. In extent, a price tag of 1 million or more will break the application horribly.</p> <p>Dave says: That’s true. Please add those kinds of validations to your version.</p> </td><td>2007-11-02</td><td></td></tr> <tr><td>265</td><td></td><td>SUGGEST</td><td><p>“Anatomy of a Migration”<br /> Migration file names must match migration class names. If they don’t match, the error shown is ‘uninitialized constant’ which is obscure, to say the least. Rails 1.2.4</p> <p>I think an earlier version of the book might have said this, since my older migrations have it right. But the current version doesn’t seem to mention it. It ought to be in the Anatomy section.</p> </td><td></td><td></td></tr> <tr><td>319</td><td></td><td>ERROR</td><td><p>def last_five<br /> @list.join(‘,’ )<br /> end<br /> Is the method name list instead?</p> </td><td></td><td></td></tr> <tr><td>283</td><td></td><td>SUGGEST</td><td><p>Suggestion: On code in the bottom of the page change line:</p> <p>require_gem “activerecord”</p> <p>to</p> <p>require ‘active_record’</p> <p>Details:</p> <p>“require_gem”, this is flagged by ruby with the following message:</p> <p>(irb):2:Warning: require_gem is obsolete. Use gem instead.</p> <p>Using ‘gem “activerecord”’ did not work for me, however what did work and did not generate any warning was ‘require “active_record” ’</p> <p>BTW: I do not fully understand the reason and would appreciate if you can enlighten on the suibject.</p> <p>Thanks<br /> Pietro</p> </td><td></td><td></td></tr> <tr><td>461</td><td></td><td>ERROR</td><td><p>Minor error in the Time-Based Expiry of Cached Pages section. A sentence reads in part:</p> <p>the page cache file for content/show/1 will be in<br /> app/public/content/show/1.html</p> <p>I believe the location should be</p> <p>public/content/show/1.html</p> </td><td></td><td></td></tr> <tr><td></td><td>193</td><td>OK</td><td><p>At the bottom of the page</p> <p>We’ll call the user “dave.”</p> <p>should read</p> <p>We’ll call the user “dave”.</p> <p>The dot and quotation mark are swapped.</p> <p>(Dave says: it’s actually correct…)</p> </td><td>2007-12-19</td><td></td></tr> <tr><td>283</td><td></td><td>ERROR</td><td><p>The link to the subversion repository for annotate_models is not valid anymore.</p> </td><td></td><td></td></tr> <tr><td></td><td>537</td><td>ERROR</td><td><p>At the bottom of the page, the code says, “<%= submit_to_remote ‘Send Email’, ‘send’…” Those parameters are reversed. In fact, on the next page, the example shows ‘<input name=“Send Email” type=“button” value=“send”’. “Send Email” should be the value, not the name.</p> </td><td></td><td></td></tr> <tr><td></td><td>546</td><td>ERROR</td><td><p>At the bottom of the page, it says, "as an HTML snippet containing just</p> <li> <p>elements." However, on the next page, the file “progforms/app/views/user/autocomplete_favorite_languages.rhtml” includes the</p> <ul> <p>too.</p> </td><td></td><td></td></tr> <tr><td>549</td><td></td><td>TYPO</td><td><p>It says “Figure 23.5: DRAG-AND-=DROP TO-DO LISTS”. I think the “=” is a typo ;)</p> </td><td></td><td></td></tr> <tr><td></td><td>557</td><td>TYPO</td><td><p>At the top of the page, it says “[No Value]”, but if you look at the image on the bottom of p. 556, it says “[No Name]”.</p> </td><td></td><td></td></tr> <tr><td></td><td>421</td><td>TYPO</td><td><p>It says, “The default parameter is unused.” I think it’s the “defaults” parameter.</p> </td><td></td><td></td></tr> <tr><td>623</td><td></td><td>TYPO</td><td><p>Re Capistrano 2.0. Could an update include Dave’s comment, so that one doesn’t spend a lot of time trying to make something work that isn’t going to? Thanks</p> </td><td></td><td></td></tr> <tr><td>526</td><td></td><td>TYPO</td><td><p>For “conditions_by_like” if would be useful to have a note about the side bar.</p> </td><td></td><td></td></tr> <tr><td>474</td><td></td><td>ERROR</td><td><p>In Rails 1.2.6, I noted the following differences regarding TextHelper functions:</p> <p>truncate() takes a 4th optionnal argument: truncate_string = “…”</p> <p>highlight() takes a 3rd optionnal argument: highlighter = ‘<strong class="highlight">\\1</strong>’</p> <p>excerpt() takes a 4th optionnal argument: excerpt_string = “…”</p> <p>auto_link(), strip_tags and strip_links() are not documented in your book.</p> <p>Regards</p> </td><td></td><td></td></tr> <tr><td>35</td><td></td><td>TYPO</td><td><p>The link to Duncan’s OSX install write-up appears to be broken. It does, however, lead to a nice picture of his alpine mountaineering.</p> </td><td></td><td></td></tr> <tr><td>613</td><td></td><td>DEFER</td><td><p>you shoud update the book with new capistrano 2</p> <p>(Dave says: this would be a new edition)</p> </td><td>2007-12-19</td><td></td></tr> <tr><td></td><td>80</td><td>TYPO</td><td><p>the download snippet, in the middle of the page, is shown as:<br /> depot_b/app/views/layouts/admin.rhtml</p> <p>it should be, in order to get the <!DOCTYPE…> statement, on the top of page 81:<br /> depot_c/app/views/layouts/admin.rhtml</p> </td><td></td><td></td></tr> <tr><td>80</td><td>71</td><td>OK</td><td><p> AddPrice: migrating ==<br /> — add_column(:products, :price, :decimal, {:default=>0, :precision=>8, :scale=>2})<br /> rake aborted!<br /> You have a nil object when you didn’t expect it!<br /> You might have expected an instance of Array.<br /> The error occured while evaluating nil.[]</p> <p>Above error on the following…<br /> Two different machines, both Nvidia based. AMD64 3000 and AMD64 6000 AM2. Kernels are i386, not AMD64.</p> <p>Cut and pasted code from website.</p> <p>Standard Debian Etch.<br /> Etch with all GEM updates applied (Rails 2.6, Ruby 1.8.5).<br /> Etch with all updates and kernel 2.6.18 or 2.6.22.<br /> Knoppix 5.0 with Gem updates.<br /> Kubuntu 7.10 with and without Gem updates.<br /> Apparently something in any Debian distro does not like rails.</p> <p>(Dave says: You need Rails 1.2)</p> </td><td>2007-12-19</td><td></td></tr> <tr><td>393</td><td></td><td>TYPO</td><td><p>Near the bottom of the PDF pages, the “default” routes.rb file is described.</p> <p>There appears to be a line of ruby missing:</p> <p>map.connect ‘:controller/:action/:id.:format’</p> </td><td></td><td></td></tr> <tr><td></td><td>181</td><td>SUGGEST</td><td><p>The file listed in the snippet ‘depot_r/test/unit/product_test.rb’ needs the portion starting from ‘def test_positive_price’ to second ‘end’ at the bottom needs to be commented out in order to get the result ‘2 tests, 6 assertions, 0 failures, 0 errors’ shown at the top of page 182.</p> </td><td></td><td></td></tr> <tr><td>76</td><td></td><td>DEFER</td><td><p>It seems the scaffold :product does not work in Rails 2.0. A note or guidance for the equivalent would be very helpful.</p> <p>(Dave says: Rails 2 breaks a lot of things. I new edition would be needed to cover it)</p> </td><td>2007-12-19</td><td></td></tr> <tr><td>141</td><td></td><td>ERROR</td><td><p>The create script needs to remove the constraints prior to drop_table:</p> <p>class CreatePropagationRecords < ActiveRecord::Migration<br /> def self.up<br /> create_table :propagation_records do |t|<br /> t.column :status_id, :integer, :null => false<br /> t.column :plant_id, :integer, :null => false<br /> t.column :quantity_required, :integer, :null => false<br /> end</p> <p>execute “alter table propagation_records add constraint fk_propagation_records_statuses<br /> foreign key (status_id) references statuses(id)”</p> <p>execute “alter table propagation_records add constraint fk_propagation_records_plants<br /> foreign key (plant_id) references plants(id)”</p> <p>end</p> <p>def self.down</p> <p>execute “ALTER TABLE propagation_records DROP FOREIGN KEY fk_propagation_records_statuses”</p> <p>execute “ALTER TABLE propagation_records DROP FOREIGN KEY fk_propagation_records_plants”</p> <p>drop_table :propagation_records<br /> end<br /> end</p> </td><td></td><td></td></tr> <tr><td>222</td><td></td><td>ERROR</td><td><p>depot/test/performance/order_speed_test.rb: DAVES_DETAILS is missing.</p> </td><td></td><td></td></tr> <tr><td></td><td>101</td><td>ERROR</td><td><p>The listing for “depot_q/app/views/login/list_users.rhtml” omits the</p> <div> <p>tags that should enclose the snippet. The “List users” link in Iteration F4’s administration sidebar didn’t work as advertised until I added the tags like this:</p> <div class="depot-form"> <h1> <p>Administrators</p> </h1> <p>…</p> </ul> </div> </td><td></td><td></td></tr> <tr><td>215</td><td></td><td>ERROR</td><td><p>Running user_stories_test.rb, as supplied gives me:</p> <p>NoMethodError: undefined method `[]’ for :put:Symbol</p> <p>Changing :put to ‘put’ results in a failure:</p> <p>Expected response to be a <:success>, but was <404></p> </td><td></td><td></td></tr> <tr><td>610</td><td></td><td>SUGGEST</td><td><p>I would suggest mentioning that in some circumstances the ssl_requirement plug-in will not be sufficient for security. e.g. if used for a ‘login’ action the username and password will have been sent in the clear on the first request so the redirect is useless.</p> </td><td></td><td></td></tr> <tr><td></td><td>526</td><td>ERROR</td><td><p>Paging is broken if you utilize the search. Results come back fine initially, however when you page next or select a different page (while using the search), the search action is utilized (vs. list) and you lose the admin layout.</p> </td><td></td><td></td></tr> <tr><td>621</td><td></td><td>TYPO</td><td><ol> <li>On the server(s) and your client (if not already installed)<br /> $ sudo gem install —include-dependencies ‘<br /> $ sudo gem install —include-dependencies rails<br /> $ sudo gem install —include-dependencies termios<br /> $ sudo gem install —include-dependencies capistrano<br /> $ sudo gem install —include-dependencies mongrel<br /> $ sudo gem install —include-dependencies mongrel_cluster </li> </ol> <p>What is gem ‘`’?</p> </td><td></td><td></td></tr> <tr><td>620</td><td></td><td>ERROR</td><td><p>I found this section quite helpful in deploying my app, however in my case it didn’t work using the recipe you gave. In Step Five on page 620 you give the apache config file that we have to put in to connect apache to the mongrel cluster. When I did this exactly as written in the book it seemed to work, however when I went to my webpage I got a 403, permission denied error.</p> <p>It seemed that for some reason apache couldn’t actually connect to the rails app. I’m not quite sure exactly why but adding this:<br /> <Proxy *><br /> Order allow,deny<br /> Allow from all<br /> </Proxy><br /> To the top of my virtual host file fixed the problem entirely.</p> <p>Thought you might want to look into it or put that in the next edition to help all those poor souls out there like me.</p> <p>Thanks again for the great book.</p> </td><td></td><td></td></tr> <tr><td>442</td><td></td><td>TYPO</td><td><p>In the middle of the page the “particular controller” RssController will unlikely subclass ActionController::Base but ApplicationController.</p> </td><td></td><td></td></tr> <tr><td>96</td><td></td><td>OK</td><td><ul> <li>I am a newbie, so this might be wrong. I just would like to<br /> report it and confirm whether my point is right or not</li> </ul> <p>in the code snippet of depot_d/app/views/store/index.rhtml<br /> there is a line of<br /> <% for product in @products -%></p> <p>I wonder if the ‘-’ symbol at the end tag is necessary.<br /> It seems like a typo to me</p> </td><td>2008-10-29</td><td></td></tr> <tr><td></td><td>180</td><td>ERROR</td><td><p>The test will not run correctly because a number of fields in the ‘line_items’ table are defined to be NOT NULL. Therefore the default fixture file will not work, and the test will return a SQL error when attempting to store the fixture data into the table (due to missing values). (This is on OS X Leopard, using sqlite3 as database, but I presume other DBs will show the same issue.)</p> </td><td></td><td></td></tr> <tr><td>35</td><td></td><td>SUGGEST</td><td><p>Now that Rails 2 is out, you might want to add a note on how to install the Rails 1.x version, so that the examples work. eg on Ubuntu<br /> (install prereqs)<br /> sudo aptitude install rubygems mysql-server-5.0 ri irb<br /> (install 1.x version)<br /> sudo gem install rails —version 1.2.6 —include-dependencies<br /> Also, would be good to add a note about adding /var/lib/gems/1.8/bin to path, so rails command works.</p> </td><td></td><td></td></tr> <tr><td>35</td><td></td><td>TYPO</td><td><p>New description of Mac OS X install at:<br /> hivelogic.com/articles/ruby-rails-mongrel-mysql-osx/</p> </td><td></td><td></td></tr> <tr><td></td><td>60</td><td>TYPO</td><td><p>Middle of the page says “…you can skip forward to Section 6.1..” But I am in section 6.1 … I think it means to say, skip the database configuration part to page 64 “Create the Products Model and Table” no?</p> </td><td></td><td></td></tr> <tr><td>274</td><td></td><td>SUGGEST</td><td><p>Rather than suggesting that join tables don’t need primary keys, you might suggest that they use the FK fields together as a composite PK.</p> </td><td></td><td></td></tr> <tr><td></td><td>503</td><td>ERROR</td><td><p>In order to retrieve the uploaded_picture name you call “picture_field.original_filename” but original_filename is not defined for Picture.</p> </td><td></td><td></td></tr> <tr><td>333</td><td></td><td>ERROR</td><td><p>Your finder_sql returns all rails line items (whether or not associated with your order)<br /> I suggest you change to :<br /> :finder_sql => “select l.* from line_items l, products p ” +<br /> " where l.product_id = p.id " +<br /> " and p.title like ‘rails’ " +<br /> " and l.order_id = #{id} "</p> <p>Thanks to the authors and rails community.<br /> You really make my coding life happier.</p> </td><td></td><td></td></tr> <tr><td>333</td><td></td><td>ERROR</td><td><p>Precision to my previous recommandation : make sure the #{id} is between single quotes, otherwise it will be interpolated to early given a wrong value.</p> <p>So change to :</p> <p>:finder_sql => “select l.* from line_items l, products p ” +<br /> " where l.product_id = p.id ’ +<br /> " and p.title like ‘rails’ " +<br /> ’ and l.order_id = #{id} ’</p> <p>Thanks to the authors and rails community.<br /> You really make my coding life happier.</p> </td><td></td><td></td></tr> <tr><td>359</td><td></td><td>TYPO</td><td><p>Last sentence of before section 18.7: “… and add the column catgories_count to your table.” -> missing e in cat*e*gories_count.</p> </td><td></td><td></td></tr> <tr><td>455</td><td></td><td>ERROR</td><td><p>Explanation of the :method parameter to “verify”: “The request method (:get, :post, :head, or :delete) must match one of the given symbols.” It seems weird that :put has been left out. If it was intentional, it should be documented. But it shouldn’t have been intentional, as the relevant code from actionpack-x.x.x/lib/action_controller/verification.rb (around lines 88-89) is</p> <p>if !prereqs_invalid && options[:method]<br /> prereqs_invalid ||=<br /> [*options[:method]].all? { |v| request.method != v.to_sym }<br /> end</p> <p>which is rather nonspecific about the actual methods.</p> </td><td></td><td></td></tr> <tr><td>483</td><td></td><td>TYPO</td><td><p>First sentence of 22.5: “A form that wraps a single Active Record module…”, should probably be “model” instead of “module”.</p> </td><td></td><td></td></tr> <tr><td>492</td><td></td><td>TYPO</td><td><p>Second paragraph, last line: ancilliary -> ancillary</p> </td><td></td><td></td></tr> <tr><td>439</td><td></td><td>TYPO</td><td><p>“… a declaration such as the following is added to the to-level application controller…” “to-level” should be “top-level”</p> </td><td></td><td></td></tr> <tr><td></td><td>93</td><td>SUGGEST</td><td><p>The second bullet point in the playtime section on this page asks the reader to make the image into a link that adds the book to the cart. However your hint in this bullet says to use the link_to helper when the text earlier on page 91 explains how this breaks the W3 GET/POST HTTP verb meanings. Suggestion: Add button_to in the suggested APIs to look up on api.rubyonrails.org. This suggests adding the :method to link_to to make it behave like button_to.</p> <p>Cheers<br /> Jim - 3dkiwi</p> <p>Note this was actually from the May 21,2007 P3.0 revision of the book which is not in your dropdown choices.</p> </td><td></td><td></td></tr> <tr><td>535</td><td></td><td>SUGGEST</td><td><p>Though identical to the link_to_remote example two pages before, the periodically_call_remote example on this page is not specifically meaningful when combined with</p> <p>:condition => “$(‘inbox_status’).innerHTML == ‘Unknown’”</p> <p>according to my understanding of the intention: simply refreshing the div content every 60 seconds.</p> </td><td></td><td></td></tr> <tr><td>568</td><td></td><td>ERROR</td><td><p>The example configuration for smtp server should be:<br /> config.action_mailer.smtp_settings = { …</p> <p>rather than<br /> config.action_mailer.server_settings = { …</p> </td><td></td><td></td></tr> <tr><td></td><td>273</td><td>TYPO</td><td><p>Well, I’m using Rails 2.0, so this may be what has the error rather than your book, but I’ll lay the whole thing out. When I execute the “ruby script/generate migration load_users_data” on my system I get class LoadUsersData, and the "require ‘active_record/fixtures’ line is omitted. It fails when I use it like this and just add the other suggested lines, but when I change to LoadUserData and add the require line as your book suggests it does in fact work for me. My apologies if this is completely Rails2 and not you at all.</p> </td><td></td><td></td></tr> <tr><td>635</td><td></td><td>TYPO</td><td><p>In line –6 “convenience” should be “convenient”</p> </td><td></td><td></td></tr> <tr><td></td><td>59</td><td>SUGGEST</td><td><p>Rails 2 by default use sqlite instead of MySQL. If you want to create the rails application using MySQLas discussed in the book, it should be done thus:</p> <p>rails -d mysql depot</p> </td><td></td><td></td></tr> <tr><td>411</td><td></td><td>ERROR</td><td><p>The ‘scaffold_resource’ generator is no longer valid. The standard ‘scaffold’ generator will now do the same job.</p> </td><td></td><td></td></tr> <tr><td></td><td>67</td><td>ERROR</td><td><p>undefined method `scaffold’ for AdminController:Class</p> <p>I’m using a newer version of rails, than that used in the book. I’m sure that this is the reason for this technical issue? How does one then rectify this problem? Or is there another reason for this particular problem?</p> </td><td></td><td></td></tr> <tr><td></td><td>121</td><td>SUGGEST</td><td><p>The first time javascript works (with ONE line?!? of code), we sort of hove to take your word for it. After all, reloading the index is likely to almost instantaneous on a test server. But if we empty the cart right before we test the AJAX, the flash saying that the cart is empty remains as we add items. Its message quickly becomes inaccurate, but the fact that the box remains is clear, absolute proof that the AJAX works.</p> </td><td></td><td></td></tr> <tr><td></td><td>111</td><td>OK</td><td><p>hello, i think that the logic of Total price in Shopping Cart is wrong. You have it wrong on the picture on same page too:</p> <p>Total price should be calculated as sum of all products in<br /> the cart (in book you are summing only prices of the cart items)</p> <p>I think instead of:</p> <p>def total_price<br /> @items.sum{|item| item.price}<br /> end</p> <p>it should be…</p> <p>def total_price<br /> @items.sum{|item| item.price*item.quantity}<br /> end</p> <p>(Dave says: look at class item)</p> </td><td>2008-10-29</td><td></td></tr> <tr><td>172</td><td></td><td>ERROR</td><td><p>Book reads “(In fact, this code still has a potential timing issue—it is still possible for two administrators each to delete the last two users if their timing is right. Fixing this would require more database wizardry than we have space for here.)”</p> <p>Is this correct? Assuming transactions are atomic, this case should not occur, since the transactions occur atomically and the one that loses the race will always report a user count of zero. However, I don’t know whether InnoDB transactions are in fact atomic.</p> </td><td></td><td></td></tr> <tr><td></td><td>124</td><td>ERROR</td><td><p>The highlight function does not work when adding the first of a product type to the cart. I.E. ‘Book A’ has no entry in the cart. When I click add to cart, I receive a type error: null value from the rjs. However, as others have posted if I click add to cart again for ‘Book A’ the highlight effect works and fades the new 2 x Book A line. It appears that some additional logic may be necessary to cover the base case for the first item of a product type.</p> </td><td></td><td></td></tr> <tr><td>293</td><td></td><td>SUGGEST</td><td><p>Regarding the Oracle adapter: it’s perhaps worth a footnote that Oracle itself behaves very differently from standard SQL with regard to empty string values. In Oracle, an empty string is exactly the same as NULL. See www.thunderguy.com/semicolon/2003/04/26/oracle-empty-string-null/<br /> and download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements005.htm#i59110</p> <p>Beware of this if migrating an app from Oracle to some other database, or vice versa.</p> <p>e.g. it’s impossible to store an empty string in a column with a :null=>false constraint [p.266]</p> <p>e.g. Oracle will never give you a mixture of NULL and empty string in a column, but other databases can. Empty fields on a form POST are empty string rather than NULL.</p> </td><td></td><td></td></tr> <tr><td>333</td><td></td><td>ERROR</td><td><p>Follow up to the fix to the :finder_sql statement — the text should also be clarified. “you can create a collection of all the line items for a particular product” should be something more like: “an order’s line items of a particular product type”. They aren’t really all line items for a product, that would be Product.line_items(…).</p> </td><td></td><td></td></tr> <tr><td>303</td><td></td><td>SUGGEST</td><td><p>As a Rails n00b, it would be good to know WHY the first example on the page is “incredibly bad Rails code”.</p> </td><td></td><td></td></tr> <tr><td>166</td><td>158</td><td>TYPO</td><td><p>source code doesn’t include authorize method code.</p> </td><td></td><td></td></tr> <tr><td></td><td>81</td><td>ERROR</td><td><p>With my setup (Debian testing, Ruby 1.8, Rails 1.2.3) the truncate helper method returns noMethodError for length. (!)</p> <p>I believe this is an error in the rails library as installed: truncate uses “string”.chars.length which is not defined for enumerable. Editing /var/lib/gems/1.8/gems/actionpack-1.13.3/lib/action_view/helpers/text_helper.rb<br /> around line 36 so that it uses “string”.length or “string”.chars.to_a.length works. Similar with the [] expression.</p> </td><td></td><td></td></tr> <tr><td>80</td><td></td><td>TYPO</td><td><p>you have to edit three files</p> <p>should read:</p> <p>you have to edit four files</p> </td><td></td><td></td></tr> <tr><td>129</td><td>116</td><td>ERROR</td><td><p>The Ajax Magic does not work with the given .rjs file specified. It gives an ‘RJS Error’. The code in the .rjs file should be ‘page.replace_html(“cart_partial” , :partial => “cart” , :object => @cart)’ instead.</p> </td><td></td><td></td></tr> <tr><td></td><td>153</td><td>ERROR</td><td><p>Line 2 in the listing is referring to a new layout file, but the book text does not describe how to create this file.</p> </td><td></td><td></td></tr> <tr><td></td><td>158</td><td>ERROR</td><td><p>Text refers to file admin_controller.rb but there is no instructions for actually creating this controller. This ties back to the missing “admin” layout file on page 153 (see other errata)</p> </td><td></td><td></td></tr> <tr><td></td><td>152</td><td>ERROR</td><td><p>Please ignore (or delete) entries #33004 and #33005 below.<br /> In the beginning of the tutorial, it shows how to create a ‘admin’ controller for the ‘products’ model using the scaffold system. I am using Rails 2.1 and the scaffold command no longer allows you to specify the controller and model seperately, so I had created a ‘products’ controller instead of the ‘admin’ controller. Therefore, I did not have an ‘admin’ controller at this point in the book. Sorry for the misleading erratas.</p> </td><td></td><td></td></tr> <tr><td>353</td><td></td><td>ERROR</td><td><p>When doing self-referential joins, the :foreign_key of the has_many should refer to the primary key id field of the table. For example, ’ has_many :managed_employees, …, :foreign_key => “employee_id” ’ (if the primary key of the employee table was employee_id).</p> <p>Your example may have worked because you use the Rails default of id for the primary key column. I use self.primary_key = “tablename_id” for all classes/tables, to make the database more self-documenting, and this may have caused your example not to work.</p> </td><td></td><td></td></tr> <tr><td>353</td><td></td><td>ERROR</td><td><p>A correction to the previous correction :-)</p> <p>If we had:</p> <p>class Employee < ActiveRecord::Base<br /> self.primary_key = “employee_id”</p> <p>then the belongs_to declaration should be:</p> <p>belongs_to :manager, :class_name => “Employee”, :foreign_key => “employee_id”</p> <p>the “has_many :managed_employees” declaration is correct.</p> </td><td></td><td></td></tr> <tr><td></td><td>66</td><td>ERROR</td><td><p>Book has:</p> <p>Edit the file so that it looks like the following:<br /> depot_a/db/migrate/001_create_products.rb</p> <p>Should be:</p> <p>Edit the file so that it looks like the following:<br /> depot/db/migrate/001_create_products.rb</p> </td><td></td><td></td></tr> <tr><td></td><td>498</td><td>TYPO</td><td><p>In gray box “Forms Containing Collections”, should the call on line 3 of the code be text_field() or text_field_tag()?</p> </td><td></td><td></td></tr> <tr><td>459</td><td></td><td>ERROR</td><td><p>At the bottom of the page, the text says to put sweeper code into app/sweepers. This is incorrect; unless you configure your rails app otherwise, sweeper code only gets loaded automatically if you put it in app/controllers (at least as of Rails 1.2.3, I haven’t tried on 1.2.5, which is the version to which the book is described to be written).</p> </td><td></td><td></td></tr> <tr><td></td><td>99</td><td>SUGGEST</td><td><p>Footnote 2 on p. 99 reads as follows: “Saying :id=>product is idiomatic shorthand for :id=>product.id. Both pass the product’s id back to the controller.” However, this explanation is a little cryptic. What context in particular causes “product” to be transformed into “product.id”? Does this happen whenever an object is used as a hash value? It would be helpful to specify this.</p> </td><td></td><td></td></tr> <tr><td></td><td>94</td><td>TYPO</td><td><p>The Play Time URL at the bottom of the page doesn’t lead anywhere. (can’t include the URL here because of form restrictions)</p> </td><td></td><td></td></tr> <tr><td></td><td>209</td><td>TYPO</td><td><p>The book says “The integration test facility is very nice: we know of no other framework that offers built-in testing at this high of a level.” Better to say “… at this high a level.”</p> </td><td></td><td></td></tr> <tr><td>213</td><td></td><td>ERROR</td><td><p>The line “xml_http_request ”/store/add_to_cart“, :id => ruby_book.id ”<br /> differs from actual code: " xml_http_request :put, “/store/add_to_cart”, :id => ruby_book.id"</p> <p>Line in book causes an error. Line in actual code is ok.</p> </td><td></td><td></td></tr> <tr><td></td><td>506</td><td>TYPO</td><td><p>Footnote 11 should say “in place of” rather than “in place for”.</p> </td><td></td><td></td></tr> <tr><td></td><td>525</td><td>TYPO</td><td><p>The last instance of the word “in” should be changed to “it” in “It turns out that in our example code… so rather than including it on every page, we’ll instead add in once, to the layout.”</p> </td><td></td><td></td></tr> <tr><td></td><td>438</td><td>TYPO</td><td><p>The word “to-level” should be “top-level” in the sentence “Every new Rails application… a declaration such as the following is added to the to-level application controller…”</p> </td><td></td><td></td></tr> <tr><td>198</td><td></td><td>TYPO</td><td><p>The set_locale method in application.rb is missing a “/” in assigning the locale_path.</p> <p>locale_path = “#{#LOCALES_DIRECTORY}#{I18n.locale}.yml”</p> <p>should be</p> <p>locale_path = “#{LOCALES_DIRECTORY}/#{I18n.locale}.yml”</p> </td><td></td><td></td></tr> <tr><td>80</td><td>NULL</td><td>TYPO</td><td><p>SUBJ2</p> </td><td></td><td></td></tr> <tr><td>78</td><td></td><td>TYPO</td><td><p>tablewhose => table whose</p> </td><td></td><td></td></tr> <tr><td>123</td><td></td><td>TYPO</td><td><p>test of slack integration</p> </td><td></td><td></td></tr> <tr><td>111</td><td></td><td>TYPO</td><td><p>Another test</p> </td><td></td><td></td></tr> <tr><td>222</td><td></td><td>TYPO</td><td><p>Third one</p> </td><td></td><td></td></tr> </table> </div> <section class="cat"> <section class="cat"> <h3>Categories:</h3> <ul> <li><a href="/categories"><i>Browse All Categories</i></a></li> <li><a href="https://pragprog.com/categories/android-ios-and-mobile/"> Android, IOS, and Mobile </a></li> <li><a href="https://pragprog.com/categories/architecture-design-and-testing/"> Architecture, Design, and Testing </a></li> <li><a href="https://pragprog.com/categories/audio-books/"> Audio Books </a></li> <li><a href="https://pragprog.com/categories/beta/"> Beta </a></li> <li><a href="https://pragprog.com/categories/brain-teasers/"> Brain Teasers </a></li> <li><a href="https://pragprog.com/categories/cloud-and-networking/"> Cloud and Networking </a></li> <li><a href="https://pragprog.com/categories/data-and-data-science/"> Data and Data Science </a></li> <li><a href="https://pragprog.com/categories/distributions/"> Distributions </a></li> <li><a href="https://pragprog.com/categories/elixir-phoenix-and-otp/"> Elixir, Phoenix, and OTP </a></li> <li><a href="https://pragprog.com/categories/for-beginners/"> For Beginners </a></li> <li><a href="https://pragprog.com/categories/functional-programming/"> Functional Programming </a></li> <li><a href="https://pragprog.com/categories/game-dev-graphics-and-media/"> Game Dev, Graphics, and Media </a></li> <li><a href="https://pragprog.com/categories/go-language/"> Go Language </a></li> <li><a href="https://pragprog.com/categories/hardware-hobby-and-home/"> Hardware, Hobby, and Home </a></li> <li><a href="https://pragprog.com/categories/java-and-jvm-languages/"> Java and JVM Languages </a></li> <li><a href="https://pragprog.com/categories/javascript/"> Java​Script </a></li> <li><a href="https://pragprog.com/categories/management-people-and-teams/"> Management, People, and Teams </a></li> <li><a href="https://pragprog.com/categories/popular-libraries-and-frameworks/"> Popular Libraries and Frameworks </a></li> <li><a href="https://pragprog.com/categories/pragmatic-answers/"> Pragmatic Answers </a></li> <li><a href="https://pragprog.com/categories/pragmatic-express/"> Pragmatic Ex​Press </a></li> <li><a href="https://pragprog.com/categories/programming-languages/"> Programming Languages </a></li> <li><a href="https://pragprog.com/categories/python/"> Python </a></li> <li><a href="https://pragprog.com/categories/ruby-and-rails/"> Ruby and Rails </a></li> <li><a href="https://pragprog.com/categories/seven-in-seven/"> Seven in Seven </a></li> <li><a href="https://pragprog.com/categories/tools/"> Tools </a></li> <li><a href="https://pragprog.com/categories/web-development/"> Web Development </a></li> </ul> </section> </section> <aside> <div class="loginbox"> <h2>Releases, Offers & More</h2> <p> Be the first to hear about our newest content, best promotions and upcoming events. Plus get <span style="font-weight: bold; font-size: 1.1em;">25% off</span> your next purchase. </p> <p> <a class="loginbtn" href="/newsletter">Newsletter Sign Up</a> </p> <hr> <h2>Download Accounts</h2> <p> Your email address is your account identifier. You can create a password, or just download from the links sent via email. </p> <p> <a href="https://transactions.sendowl.com/customer_accounts/164668" class="loginbtn">My Orders</a> </p> <p> (<a href="https://transactions.sendowl.com/order_recoveries/new?merchant_id=164668" style="color: white;">Resend order emails</a>) </p> </div> <div class="box"> <h2>How We're Different</h2> <ul class="compact"> <li><p>Hands-on instructions</p></li> <li><p>Solutions to real-world problems</p></li> <li><p>DRM-free ebooks</p></li> <li><p>Free updates within an edition</p></li> <li><p>Pioneered Beta books</p></li> <li><p>We're software developers, too</p></li> </ul> </div> </aside> <footer class="footer"> <ul style="margin-block-end: 0.5em"> <li><a href="/contact">Contact</a></li> <li><a href="/about">About Us</a></li> <li><a href="/privacy">Privacy</a></li> <li><a href="/terms-of-use">Terms of Use</a></li> <li><a href="/security">Security</a></li> <li><a href="/newsletter">Newsletter</a></li> <li><a href="https://www.giftya.com/brands/1568049/pragmatic-bookshelf" target="_blank">eGifts</a></li> <li><a href="/promotions">Partnerships & Promotions</a></li> <li><a href="/careers">Careers</a></li> </ul> <div style="font-size: 70%; color: #C2CBC2"> © 1999-2025 The Pragmatic Programmers, LLC. All Rights Reserved. </div> </footer> <script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script> <script> window.cookieconsent.initialise({ "palette": { "popup": { "background": "#915465", "text": "#ffdddd" }, "button": { "background": "#93535B" } }, "theme": "classic", "content": { "message": "This website uses cookies for navigation, order transactions, and general analytics. ", "href": "https://pragprog.com/privacy" } }); </script> </div> </body> </html>