The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".
The following errata were submitted by our customers and approved as valid errors by the author or editor.
Version |
Location |
Description |
Submitted By |
Date submitted |
Date corrected |
|
Sec.2.5
2nd Paragraph |
As printed:
... without turning "this is <b>bold</b>" into "this is <b>bold</b>."
should be
... without turning "this is <b>bold</b>" into "this is <b>bold</b>."
I was reading the safari version, so this may be an example of an HTML transcription error.
Note from the Author or Editor: I think this a case of the Safari conversion not quite working. The original on page 25 in the printed version looks fine.
|
Anonymous |
Dec 03, 2008 |
|
|
~140
After chapter 8 |
Using the code from the code repository, or the version I'd built up from the beginning of the book, when editing, or creating a new person, all the fields are labelled 'Label'.
Note from the Author or Editor: In this case, the recommendation of the note on 137 appears to have become mandatory.
Please replace (in DocBook) from the private on 136 to the end of the note on 137 with:
<programlisting format="linespecific" id="I_programlisting8_d1e11062">private
def label_for(method, options={})
label(options.delete(:label) || method) + "<br />"
end</programlisting>
<para>The <literal moreinfo="none">label</literal> method is the same
as usual and is concatenated to a <literal moreinfo="none"><br
/></literal> tag, but there?s something tricky going on in the
arguments:</para>
<programlisting format="linespecific" id="I_programlisting8_d1e11073">(:label || method)</programlisting>
<para>This looks for an option named <literal moreinfo="none">:label</literal>, letting you specify label text for
the field through a <literal moreinfo="none">:label</literal>
parameter. Accessing the <literal moreinfo="none">:label</literal> value
through <literal moreinfo="none">delete</literal> <indexterm id="I_indexterm8_d1e11113" significance="normal">
<primary>delete method</primary>
<secondary sortas="label parameter with">:label parameter
with</secondary>
</indexterm>seems strange, but <literal moreinfo="none">delete</literal> does two things: it removes the
<literal moreinfo="none">:label</literal> parameter from the
<literal moreinfo="none">options</literal> array, which will keep it
from passing through to the <literal moreinfo="none">super</literal>
call, and it also returns the <literal moreinfo="none">:label</literal> parameter?s value, if there is
one. (This was optional in Rails 2.1, but appears to be mandatory in Rails 2.2 and later.) If there isn?t a <literal moreinfo="none">:label</literal>,
the <literal moreinfo="none">||</literal> <indexterm id="I_indexterm8_d1e11089" significance="normal">
<primary sortas="@pipe@pipe">|| syntax</primary>
</indexterm>will fall through to <literal moreinfo="none">method</literal>, which will create a label with the
default?the internal name of the field.</para>
|
Carey Barnett |
Feb 24, 2009 |
|
|
Section 4.3.2.1
Following Example 4-6 |
... "!@name.blank? will test for both nil values and blank entries. (blank is a Ruby method of String objects." ...
The #blank? method is actually a Rails (ActiveSupport) extension applied to several classes in /core_ext/blank.rb. See also http://api.rubyonrails.org/classes/Object.html.
Note from the Author or Editor: On page 51, para below Example 4-6, replace "blank is a Ruby method of" with "blank is a Rails method extending Ruby's "
|
Anonymous |
Apr 08, 2009 |
|
PDF |
Page xviii
1st paragraph |
xviii | Preface states:
We?ll post updates in new versions of this electronic book
and at http://www.excursionsonrails.com.
but that URL gives the default Apache page ("It works!"). Dropping the "www" from the URL gives the Excursions on Rails site. Please either update the electronic version or add a redirect to the correct site. Thanks.
Note from the Author or Editor: I fixed this in the website config, and it works now. Thanks for letting me know!
No need to change the book.
|
Anonymous |
Nov 29, 2010 |
|
|
6.2
Just after Example 6-2 |
The author writes that "Most of this should be familiar, as even the simple model had a form_for, a label, and a text_field."
However, this is the first time that form_for shows up in the text: it is true that the scaffolding generated it, but it was neither referenced to, nor explained, earlier.
It would be nice to see an explanation of what form_for does.
Note from the Author or Editor: Nice catch!
On page 84, please bold line 5 of Example 6-2, the form_for line.
Delete "Most of this should be familiar, as even the simple model had a form_for, a label, and a text_field."
Then delete ", though" from the following sentence.
Then insert this before "The :description" -
-----------------
The form_for method sets up an f variable that the other methods here will rely on for context, and is described in depth in the next section.
-----------------
(The "f" in "f variable should be constant-width, as should form_for.)
|
Michael Rogers |
Dec 24, 2008 |
|
|
6.8
towards the bottom |
When you're describing the parameters date_select can accept, you list :include_seconds and its description twice.
Note from the Author or Editor: This is correct, and appears on page 98 of the print edition. Please delete the second entry for :include_seconds, which is right above the tip. And please delete the tip as well - the "Chapter 17" it refers to is incorrect.
|
Mike Ottinger |
Dec 05, 2008 |
|
|
9.3
9.3.2. Changing the controller (Nesting awards in students) |
After modifying the controller and the view code the new function get_student fails because it doesn't get the student ID
Below is the error code generated by the Mongrel server
Processing AwardsController#index (for 127.0.0.1 at 2009-09-18 12:24:42) [GET]
ActiveRecord::RecordNotFound (Couldn't find Student without an ID):
app/controllers/awards_controller.rb:96:in `get_student'
Rendered rescues/_trace (188.0ms)
Rendered rescues/_request_and_response (0.0ms)
Rendering rescues/layout (not_found)
Below the rails environment
Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.3
Active Record version 2.3.3
Action Pack version 2.3.3
Active Resource version 2.3.3
Action Mailer version 2.3.3
Active Support version 2.3.3
Application root C:/Documents and Settings/SSanjuan/Mis documentos/Ruby/Rails/students
Environment development
Database adapter mysql
Database schema version 20090918095050
Thanks
Note from the Author or Editor: This looks to me like the before_filter line was left out of the code you ran. I'm not certain.
|
Salvador |
Sep 18, 2009 |
|
Printed |
Page 31
First code sample |
In describing how to pass parameters to the stylesheet_link_tag, the following is written:
<%= stylesheet_link_tag :media => "all", :type => "text/css", :href => "/stylesheets/hello.css" %>
When the page is reloaded in the browser, the style does not take. This is confirmed by the lack of a link tag for the style sheet in the browser's source code window.
I tried this instead:
<%= stylesheet_link_tag 'hello', :media => "all", :type => "text/css", :href => "/stylesheets/hello.css" %>
Later on the page, in the fourth paragraph, it mentions that providing an href parameter overrides the first, unnamed parameter. I assume this to mean the missing 'hello' but that does not appear to be the case.
I tested this in both Safari and Firefox.
I believe this is an error in the text, but perhaps I am missing something?
Note from the Author or Editor: On page 31, please replace the first (bold) code example with:
<%= stylesheet_link_tag 'hello', :media => "all", :type => "text/css", :href => "/stylesheets/hello.css" %>
|
Anonymous |
Feb 01, 2009 |
|
Printed |
Page 32
Example 3-3 |
The href parameter in the stylesheet_link_tag statement should be "/stylesheets/hello.css" not just "/stylesheets/"
Note from the Author or Editor: In line 4 of Example 3-3, please change:
:href => "/stylesheets/"
to:
:href => "/stylesheets/hello.css"
|
Mike Smith |
Feb 08, 2009 |
|
|
32
Unsure as I am reading via Safari Library |
"replace the old app/views/hello/index.rhtml"
should read:
"replace the old app/views/hello/index.html.erb"
Note from the Author or Editor: This appears on page 33 on the printed edition in the second text paragraph.
Please change:
"replace the old app/views/hello/index.rhtml"
to:
"replace the old app/views/hello/index.html.erb"
|
Wil Harper |
Sep 08, 2009 |
|
Printed |
Page 37
second paragraph |
"The structure created by the <% content_for(:name) do %> code in Example 3-9" should read "The structure created by the <% content_for(:list) do %> code in Example 3-9."
Note from the Author or Editor: This is correct - please do as suggested:
The structure created by the <% content_for(:name) do %> code in Example 3-9" should read "The structure created by the <% content_for(:list) do %> code in Example 3-9."
|
sean kearney |
Jan 19, 2009 |
|
Printed |
Page 37
Example 3-10 caption |
The caption for Example 3-10 says "Template with added yield...." Shouldn't the word "Template" be replaced with "Layout"?
I realize it's a minor issue, but in the 3rd paragraph it mentions the "layout" in Example 3-10, and you are talking about Template Data (the view) being shared with the layout.
Note from the Author or Editor: On page 37, in the caption for Example 3-10, replace "Template with added yield" with "Layout template with added yield"
|
Leland Irwin |
Apr 22, 2009 |
|
Printed |
Page 42
line 2 |
It says:
"create app/views/entry"
in the commands output. However we created an entries controller. Therefore it should say:
"create app/views/entries"
Note from the Author or Editor: This is correct. Please change line 2 on page 42 to "create app/views/entries". Also change app/views/entry in the paragraph above the note to /app/views/entries.
|
Brendan Nolan |
May 17, 2009 |
|
Printed |
Page 42
hint |
There is no section in chapter 1 called "turning off databases, for now." Instead, the section is called "dodging database issues."
It's best to use a page number or a section number, using a professional typesetting program like LaTeX would make that easy.
Admittedly, this is a much better written book that "Agile Web Development with Rails," which was written for those adept at writing web applications. You have well targeted your material and I find this a refreshing read. Thank you.
Note from the Author or Editor: This is correct, but fortunately the problem has faded with the shift to SQLite.
|
Джон Сташко |
Mar 07, 2011 |
|
Printed |
Page 43
last paragraph |
Implementing the book's example in Heroku Garden, I got this error when I went to http://myapp.herokugarden.com/entries/sign_in :
Routing Error
No route matches "/entries/sign_in" with {:method=>:get}
I fixed the problem by inserting this line into config/routes.rb :
map.connect ':controller/:action'
Unless I'm missing something, you might want to alert readers about this.
(BTW if you would show date stamps on the errata, that would let me know which ones are new since the last time I wrote them into my copy of the book.)
Note from the Author or Editor: This appears to be a bug that came into Heroku (then Heroku Garden) after the book was published.
However, as Heroku Garden closed, and none of this functionality is available any longer, I'm afraid there isn't much we can do.
|
Mark Latham |
Apr 16, 2009 |
|
Printed |
Page 43
24th line down |
This is not really a mistake per se...so much as perhaps needing more details. Since Mark Latham also posted about this I will put my .02 cents in.
This example fails to work and gives you this error:
Routing Error
No route matches "/entries/sign_in" with {:method=>:get}
if you do not start the server. There should maybe be a step explicitly explaining starting and stopping servers. It would help if there were a few lines explaining to stop the "hello" server and start the "guestbook" server (or just leave the "hello" server running and run two servers).
This may trip up some users, particularly if you read these chapters all in a row without stopping.
Note from the Author or Editor: This appears to be a bug that came into Heroku (then Heroku Garden) after the book was published.
However, as Heroku Garden closed, and none of this functionality is available any longer, I'm afraid there isn't much we can do.
|
Brendan Nolan |
May 17, 2009 |
|
Printed |
Page 43
Example 4-2 |
The tag 'visitor_name' used in the book and the codeDirectFromBook does not match the tag 'visitorName' used in the code samples in ch04/guestbook001/app
Note from the Author or Editor: The code samples should reflect the usage in the book, which is more Rubyish. I'll update the code sample.
|
Tom Peel |
Aug 20, 2009 |
|
Printed |
Page 43
24th line |
I think the question raised by Brendan Nolan in an earlier errata was misunderstood. It does NOT refer to Heroku. What he (and I) were tripped up by is the fact that a rails server on a platform like the Macintosh does not serve up more than one project at a time.
As I worked through the examples, I started the "hello" server. Since the book never told me to kill the "hello" server before starting the "guestbook" server, I spent a few moments trying to see the guestbook app from the already running "hello" server. The fact that each rails server only serves a single app may be too obvious to notice for a rails veteran, but it clearly has tripped up at least a few readers.
This transition from the "hello" project to the "guestbook" project would be a natural place to mention the need to stop and start servers as one moves from project to project.
Note from the Author or Editor: Yes, I've tried to update the text throughout to indicate that you must kill one server process before starting another.
|
Eric Celeste |
Feb 07, 2010 |
|
Printed |
Page 45
2nd paragraph |
The second paragraph on page 45 refers to the 'entry' controller, but the script/generate command used on page 41 created an 'entries' controller and figure 4-3 on the same page shows the controller as being 'entries'.
Another reference to 'entry' is in the 3rd paragraph, first sentence on page 45.
Note from the Author or Editor: On page 45, at line 3 of paragraph 2, and line 1 of paragraph 3, please replace entry with entries.
|
Leland Irwin |
Apr 22, 2009 |
|
PDF |
Page 47
Chapter 4, 1st Paragraph |
There is an error in pluralization on the controller's name:
ruby script/generate controller entries
instead should be:
ruby script/generate controller entry
This after impede to have all table's entries shown by the sign_in...
Note from the Author or Editor: This is correct. I fixed it somewhere along the way, but unfortunately failed to update this erratum.
|
Davide Ganz |
Apr 19, 2010 |
|
Printed |
Page 48
5th paragraph |
text reads "Both of these operate on a table called People [...]" Shouldn't it read "Both of these operate on a table called Entries [...]"
Note from the Author or Editor: Please replace "People" with "Entries". Somehow this slipped through.
|
Anonymous |
Nov 27, 2008 |
|
Printed |
Page 50
Paragraph beginning with "The first step creates..." |
"People table" should be "Entry table" [similar to previously submitted errata on Page 48, 5th paragraph].
Note from the Author or Editor: "People table" should change to "Entry table" as described.
|
sean kearney |
Jan 19, 2009 |
|
Printed |
Page 50
4th and 5th paragraphs from the bottom |
Repeated referral to @myEntry in examples and text. These should be @entry.
Clearly the author made a decision during the writing to move to a more ruby_like naming convention. I wish he spent some time talking about naming. In particular there are repeated references to the potential conflict with reserved words (see first paragraph of this page for an example), but no hints as to how to avoid them. Would it be ruby_ish enough, for example, to create ones own "name space" by always prefixing a given string to anything you create (variables, objects, etc)? In this case "gb_" for "guestbook" might be reasonable.
If this were done, it raises other rails-related issues, like the difference between the underscore and CamelCase references to related entities. On this page, for example, there would be the bold example line "@gb_entry = GbEntry.create({:gb_name => @gb_name})". Does this fly, by ruby and rails convention? Or does this get you laughed out of the gem saloon?
Clearly the author had a change of heart somewhere along the way, and the scattering of typos in this section of the book attest to this. I think other developers, like myself, coming from other languages will be asking themselves similar questions. Maybe a future edition of the book could briefly address the topic.
Note from the Author or Editor: Sorry - yes, we had a change of heart. A few. We're trying to shift everything appropriate out of CamelCase.
On reserved words, the place to look is http://oldwiki.rubyonrails.org/rails/pages/ReservedWords, which does get pointed to a few times from the book.
|
Eric Celeste |
Feb 07, 2010 |
|
Printed |
Page 51
2nd paragraph |
"People table" should be "Entries table" [similar to previously submitted errata on pages 48 and 50].
Note from the Author or Editor: Please change "People table" in the second text paragraph of page 51 to "Entries table".
|
Mark Latham |
Apr 16, 2009 |
|
Printed |
Page 59
Last paragraph, first sentence |
To the end of the first sentence, add the phrase, "named people", so that it reads "To get started, create a new application named people" For clarity, add the command
$rails people
Note from the Author or Editor: Please add 'named people' to the first sentence of the last para. Then insert a paragraph break and put in:
$ rails people
Then continue.
|
Anonymous |
Dec 29, 2009 |
|
Printed |
Page 59
Last paragraph, first sentence |
In addition to the previous errata to add ', named people.' to the end of the first sentence, the next command line instruction should be inserted, to say: then, "cd people". (i.e., the user must be in the people directory for the next ruby command to work correctly.)
Note from the Author or Editor: Correct - added the cd guestbook line. (The app is guestbook, not people, so it's cd guestbook, but what a thing to miss.)
|
Rick Casey |
Jun 04, 2010 |
|
Printed |
Page 60
warning/caution paragraph |
text reads "[...] the problem is likely that you're starting in the same guestbook application described in the previous chapter, and the Person model there is blocking the creation of the Person model here."
The previous chapter, Chapter 4, features an Entry model, not a Person model, so there shouldn't be a conflict at all.
Note from the Author or Editor: Entire warning should be deleted. This is what we get for changing examples.
|
Anonymous |
Nov 27, 2008 |
|
Printed |
Page 69
Figure 5-6 |
The figure makes reference to 'students' even though in this chapter you've been referring to the 'people' controller (see Example 5-1 on page 66).
Note from the Author or Editor: ouch. This is correct. In Figure 5-6, in the left-most column, please replace every instance of '/students' with '/people'.
In the ovals, replace 'students' with 'people' and 'student' with person.
There are lots of these.
|
Leland Irwin |
Apr 23, 2009 |
|
PDF |
Page 77
first line |
CRUD doesn't really map to CREATE, SELECT, UPDATE, and DELETE in SQL terms.
CREATE should be INSERT
"you've worked with SQL, you're already familiar with INSERT, SELECT, UPDATE, and DELETE"
Note from the Author or Editor: This is correct - I'm not sure quite what I was thinking, or not thinking, at the time. It's definitely INSERT.
On page 65 of the printed book, in the 4th paragraph from the bottom, near the end of the third line, "CREATE, SELECT," should be "INSERT, SELECT,"
|
Andy Gaskell |
Dec 18, 2008 |
|
Printed |
Page 82
2nd and 3rd lines |
Instead of:
"accepting only the values of 0 and 1, equal to true and false"
I would find it clearer to say:
"accepting only the values of 1 and 0, equal to true and false"
or:
"accepting only the values of 0 and 1, equal to false and true"
especially since this mapping is not an invariable standard (e.g. see http://en.wikipedia.org/wiki/Boolean_datatype#Ruby).
Note from the Author or Editor: On page 82, lines 2 and 3, please replace:
"accepting only the values of 0 and 1, equal to true and false"
with:
"accepting only the values of 1 and 0, equal to true and false"
|
Mark Latham |
Apr 17, 2009 |
|
Printed |
Page 84
Example 6-2 |
I understand the book was written using rails 2.1; I am using rails 2.2.2.
When I open new.html.erb in example 6-2, it displays the following:
<h1>New person</h1>
<% form_for(@person) do |f| %>
<%= f.error_messages %> ...
The book shows the following:
<h1>New person</h1>
<%= error_messages_for :person %>
<% form_for(@person) do |f| %> ...
Did the scaffold output change in the most recent rails update?
Note from the Author or Editor: This is correct - Rails 2.2.2 changed the scaffolding. It sounds like more changes will be coming with 2.3 as well.
<%= error_messages_for :person %>
should become:
<%= f.error_messages %>
|
Anonymous |
Feb 21, 2009 |
|
Printed |
Page 86
Fig 6-1 |
The author fails to describe how to get the form for 'New person' shown in Fig 6-1, p 86, to appear. The way to do this is to enter the URL http://localhost:3000/people after starting the webserver when in the project /guestbook.
(I consider this a significant omission, as it took me hours of wandering around the example to figure this out, which I did only after inspecting the routes.rb file. If a new user just enters the URL http://localhost:3000/guestbook, as all the previous examples used, they will get a routing error.)
Note from the Author or Editor: Sorry - the screenshot even cut that off. I've added an explicit reference.
|
Rick Casey |
Jul 12, 2010 |
|
Printed |
Page 87
Last sentence |
The author writes: "Underneath, form_for is pretty much a form-specific version of the link_to method shown in Chapter 2. Like link_to, it understands Rails' routing and will choose its attributes based on that routing."
I don't recall being introduced to a link_to method in Chapter 2. I double checked the index to see if I overlooked link_to, but the first mention of that method is mentioned on page 160.
Note from the Author or Editor: This is correct. I'll have to add more detail in a future revision.
|
E.M. Brown |
Feb 21, 2009 |
|
PDF |
Page 97
First paragraph |
The generated code for favorite time:
<p>
<b>Favorite time</b><br />
<%= f.datetime_select :favorite_time %>
</p>
Keeps causing the saved time to be something like this:
Sat Jan 01 01:53:00 UTC 2000
No matter what I pick, that's what I get.
Note from the Author or Editor: The place to fix this is actually on page 83. In the bold script/generate scaffold command near the top, change favorite_time:time to favorite_time:datetime.
In a future edition I'll need to explain time and datetime, but recent versions of Rails seem to treat time as a datetime with the date permanently set to 1/1/2000. Earlier versions just treated it as a datetime.
|
Eric Gruber |
Mar 29, 2009 |
|
Printed |
Page 98
Middle part |
page 98 in the middle part, it said as follows:
"You'll find some more exciting options for handling dates and times in chapter 17"
But, until now, I didn't find something related to dates and times in Chapter 17.
Note from the Author or Editor: Sorry - this was a reference to content that never actually came to exist. Deleted.
|
Anonymous |
Apr 12, 2010 |
|
Printed |
Page 100
Example 6-6 |
The code to call the 'buttons' helper method reads buttons(:person, nations), but it should read buttons(:person, :country, nations). Please note that the code on the excursionsonrails.com website doesn't feature the view code _or_ the helper code at all.
Note from the Author or Editor: In the book, the bold text in Example 6-6 should change from:
buttons(:person, nations)
to:
buttons(:person, :country, nations)
Also, on page 102 - in Example 6-8, in the line immediately after "return html", there's an extraneous "end". Please delete it.
I'll update the sample code to include these.
|
Anonymous |
Nov 29, 2008 |
|
Printed |
Page 114
2nd paragraph |
The word 'password' should be 'secret' since that is what is being validated.
Note from the Author or Editor: On 114, 2nd paragraph, please replace "if a user enters a password" with "if a user enters a secret".
|
Leland Irwin |
Apr 23, 2009 |
|
Printed |
Page 117
2nd paragraph |
For the 'validates_uniqueness_of' options, there should be a comma after ':scope => [:name, :secret]'.
Note from the Author or Editor: This is correct. Please add a comma after :scope => [:name, :secret]
|
Ray Drainville |
Apr 02, 2009 |
|
Printed |
Page 124
last code example on page |
Rails 2.2.2 seems to have changed how it handles the _path helper methods. As a result, when the @person object has nil fields, the person_path(@person) method doesn't work, and you can't get a form for creating a new person. (For more, see http://forums.oreilly.com/content/Learning-Rails/929/Routing-Error-Chapter-8/)
Note from the Author or Editor: Please replace:
:url => person_path(@person),
with:
:url => { :action => ( @person.new_record? ? "create" : "update" ) },
Thanks!
|
Simon St. Laurent |
Dec 29, 2008 |
|
Printed |
Page 128
code example |
I use aptana radrails.
When I type that code in I get an error for:
def photo=(file_data)
unless file_data.blank? <--- file_data is underscored by compiler
end
end
error says more method calls made to object than self. consider moving method to object.
Note from the Author or Editor: I think this is Aptana making a suggestion, not broken code, but I'm not really sure.
|
Todd Robertson |
Jan 04, 2010 |
|
Printed |
Page 131
first graphic |
The authors fail to show the code for editing a record that handles the photo upload. They *did* show the code for 'showing' a record, but not 'editing' a record. This is troublesome omission.
Note from the Author or Editor: Thank you - this omission has been corrected. Rails 3's changes to scaffolding actually made it go away, but I've also added text to clarify.
|
Rick Casey |
Aug 02, 2010 |
|
Printed |
Page 134
Example 8-2 |
There seems to be nothing in the text that suggests that Example 8-2 should be named "tidy_form_builder.rb". Of course, the class name is a clue, and there is a reference to the sample code, but most of the previous additions to the example rails application are quite specific about the file(s) to which code is to be added and/or what files need to be created.
Note from the Author or Editor: The caption to Example 8-2 should be modified to say "A form builder, stored in app/helpers/tidy_form_builder.rb, providing a method more tightly bound to the expectations of the country field."
Also, on page 135, the first line under the first code piece should say "Rails will know to look for /app/helpers/tidy_form_builder.rb."
|
Anonymous |
Dec 04, 2008 |
|
Printed |
Page 134
2nd paragraph |
The text mentions that Rails has its own country_select, but the method is deprecated since 2.2, and is now only available as a plugin.
Note from the Author or Editor: Please change:
(Rails has its own
to:
(Prior to version 2.2, Rails had its own
|
Tom Peel |
Aug 26, 2009 |
|
Printed |
Page 137
last paragraph |
Though there is a reference in passing to a "WrappingTidyBuilder" which "builds on the prior TidyBuilder..." there is no indication where this code goes. Moreover, since there is the reference that it "...builds on the prior TidyBuilder..." which would imply this is a new class that inherits from TidyBuilder? Again, there is simply no mention of this, directly. Asking the reader to infer all this makes me think the authors were not targeting this book at beginners at all, and assumes a great deal of knowledge for the user must know. My assumption is that the authors meant this to a new class that inherits from WrappingTidyBuilder -- however, there is no evidence of this in the sample code that is provided. This makes for pretty rough sledding for us beginners! (sure enough, these changes do _not_ show up in my form, as the text explains it)...
Note from the Author or Editor: Excellent catch! The writing assumed the code was available, which has not always been the case. I've updated the text and will make sure the code bundle is also correct.
|
Rick Casey |
Aug 10, 2010 |
|
|
144
Definition of lable_for |
In rails 2.3.8, customizing text_filed method as follows leads to literal "Name <br/>" label instead of "Name" followed by a line break.
def label_for(method, options={})
label(options.delete(:label) || method) + "<br />"
end
How should we fix this?
Thanks,
Note from the Author or Editor: There was a shift in how Rails handled escaping code. Right now, the way to do this is:
label(options.delete(:label) || method).safe_concat("<br />")
That should take care of it, and is fixed in the new edition.
|
SHital |
Aug 29, 2010 |
|
Printed |
Page 147
2nd paragraph, 4th line |
"belong_to" should be "belongs_to"
Note from the Author or Editor: On page 147, 2nd paragraph, 4th line, please change belong_to to belongs_to. This also affects an index entry.
|
Mark Latham |
Apr 18, 2009 |
|
|
149
8.2.2. Adding Automation - last two paragraphs |
On the last two paragraphs, it says:
here's one last bit to notice. Remember how country_select calls the select method? It now calls the method that provides the label. That means that you can simplify:
<p>
<%= f.label :country %><br />
<%= f.country_select :country %>
</p>
to:
<p>
<%= f.country_select :country %>
</p>
If you follow up the instructions up to this point, this will not work is, as the step for adding select method was apparently missing (although it does appear in the code examples). So before this paragraph, should this be added:
def select(method, choices, options = {}, html_options = {})
label_for(method, options) + super(method, choices, options, html_options)
end
Note from the Author or Editor: This is on 137 of the printed book.
In the second section of code (beginning with def datetime_select), please append:
def select(method, choices, options = {}, html_options = {})
label_for(method, options) + super(method, choices, options, html_options)
end
to the end.
|
Rilindo Foster |
Jun 06, 2009 |
|
Printed |
Page 149
validates_existence_of at top of page |
I feel you should let the reader know that they should restart the server as I got:
NoMethodError (undefined method `validates_existence_of' for #<Class:0x23d0e08>):
app/models/award.rb:7
app/controllers/awards_controller.rb:5:in `index'
in the logs until I restarted.
Note from the Author or Editor: Please change "Now, if you try to save an award record" to "Now, if you restart the server and try to save an award record"
|
Rob Levin |
Jul 02, 2009 |
|
Printed |
Page 149
3rd paragraph |
The third paragraph states:
"and add this line underneath the belongs_to declaration of app/models/awards.rb:"
The file name should be "award.rb" not "awards.rb."
Note from the Author or Editor: Please change awards.rb to award.rb.
|
R.N. |
Sep 09, 2009 |
|
PDF |
Page 160
3rd paragraph |
There is no reference to Ch08/guestbook009. The text skips from 008 to 010.
Note from the Author or Editor: This is correct, but it doesn't actually cause problems. I'll fix it in a future edition.
|
Rick Nobleman |
Sep 07, 2009 |
|
Printed |
Page 162
5th paragraph down. |
Refers to figure b-3 of appendix B. I think this should probably be b-5 as that clearly is a join table.
Note from the Author or Editor: This is correct. Please replace "Figure B-3" with "Figure B-5".
|
Rob Levin |
Jul 02, 2009 |
|
PDF |
Page 165
After the second paragraph past the first block of code |
I'm having problems with the course_remove method. When I go to remove a course from a student (example: http://localhost:3000/students/3/course_remove) after pressing the "Remove checked courses" button, I get this error:
Unknown action
No action responded to course_remove. Actions: course_add, courses, create, destroy, edit, index, name, new, show, and update
I've done quite a bit of checking, but I can't figure out what I'm doing wrong. Any ideas? Other than that, the application seems to be working fine.
Note from the Author or Editor: I think this was a routing issue in an earlier version of the code. It appears to behave properly now.
|
Eric Gruber |
Apr 08, 2009 |
|
Printed |
Page 171
First line in top of the page |
Instead of double quotes it should be single quotes in the <%= submit_tag 'Remove checked courses' %>.
It cause me problem by unprocessing my ?course_remove_student_path(@student)? url request
Note from the Author or Editor: The quotes really shouldn't matter. Double quotes make it a string that allows substitution, but there isn't any here.
However, single quotes are better practice in any event, so please change <%= submit tag "Remove checked courses" %> to <%= submit tag 'Remove checked courses' %>.
|
Anonymous |
Feb 15, 2009 |
|
Printed |
Page 225
middle of page |
"the third name stores that name" should be:
"the third line stores that name"
(Also, changing from 'visitor_name' in Examples 4-2 & 4-3 to 'visitorName' in Examples 13-1 & 13-2 was a bit distracting, since I copied & pasted some code.)
Note from the Author or Editor: All on page 225:
in Example 13-1, line 4: replace :visitorName with :visitor_name.
fourth line, first para after 13-1: replace :visitorName with :visitor_name. Then replace "the third name stores that name" with "the third line stores that name".
in Example 13-2, line 5: replace 'visitorName' with 'visitor_name'.
|
Mark Latham |
Apr 20, 2009 |
|
Printed |
Page 225
Example 13-2 |
On the user's first visit, with no cookie named "name", this condition:
<% if @previous_name != '' %>
is true because nil is not the same as blank (at least in Heroku Garden; not sure about other environments).
So user sees the message:
"Hmmm... the last time you were here, you said you were ."
Here's one way to fix it:
<% if !@previous_name.nil? and @previous_name != '' %>
Note from the Author or Editor: On page 225, Example 13-2, please replace:
<% if @previous_name != '' %>
with:
<% unless @previous_name.blank? %>
|
Mark Latham |
Apr 20, 2009 |
|
Printed |
Page 234
Last paragraph |
After rake db:sessions:create, two more steps needed to make SessionStore work:
rake db:migrate
uncomment secret in controllers/application.rb
Note from the Author or Editor: Please change:
database support for session storage.
to:
database support for session storage, and should then also run <literal moreinfo="none">db:migrate</literal>. You'll also need to edit the <filename moreinfo="none">app/controllers/application.rb</filename> file to uncomment the <literal moreinfo="none">:secret</literal>.
|
Mark Latham |
Apr 21, 2009 |
|
PDF |
Page 260
Globbing |
"accessible through the :specs parameter"
Shouldn't :specs be :steps?
Note from the Author or Editor: Yes indeed! In the paragraph in the middle of the page, starting with "The asterisk" please change :specs in the second line to :steps.
|
emnaki |
Feb 14, 2009 |
|
Printed |
Page 273
16.3.1 - Making the Form More Scriptable |
(this applies to both the online and print edition).
Under Example 16-1, the code:
:html => {:id =>
'enrollment_form'}
Needs to between the first and second parenthensis, so that instead of:
<% form_tag(course_remove_student_path(@student)), :html => {:id =>
'removal_form'} do %>
It will be:
<% form_tag(course_add_student_path(@student), :html => {:id =>
'enrollment_form'}) do :%>
The change will have to be made on the "course_remove_student_path" and "course_add_student_path" - otherwise, it'll crash.
Also, this:
<table id="CoursesEnrolled">
Needs to bolded.
On another note, the paragraph before example 16-2 was incorrect. Besides changing:
"Course.find(params[:course]"
to
"course_ids = params[:courses]"
you also have to create a
"course_ids.each do |course_id|"
*stuff*
end
block and then put the existing "unless @student.enrolled_in?(course)" block within it. That was in the source coded in the example, but the paragraph didn't explain that you need to do that.
Note from the Author or Editor: Thank you - these changes are correct.
|
Rilindo Foster |
Jul 25, 2009 |
|
Printed |
Page 273
Example 16-1 |
This line prevented page from loading
<% form_tag(course_remove_student_path(@student)), :html => {:id => 'removal_form'} do %>
fixed by moving closing parentheses
<% form_tag(course_remove_student_path(@student), :html => {:id => 'removal_form'}) do %>
Note from the Author or Editor: Please move closing parens so line reads:
<% form_tag(course_remove_student_path(@student), :html => {:id => 'removal_form'}) do %>
|
Dennis Driver |
Dec 01, 2009 |
|
Printed |
Page 273
Example 16-1 (Line 4) |
The following code:
:html => {:id => 'removal_form'}
Should be:
{:id => 'removal_form'}
*remove the :html =>
Note from the Author or Editor: Correct.
|
Josh Pinter |
Mar 06, 2010 |
|
Printed |
Page 274
Line 6 of first code block (continued from p.273) |
The code:
<tr id = "<%= "dom_id(course)" %>">
Should be changed to:
<tr id = "<%= dom_id(course) %>">
*Remove extra quotation marks
Note from the Author or Editor: Yes, definitely. I wonder how I managed to get those extras in there.
|
Josh Pinter |
Mar 06, 2010 |
|
Printed |
Page 274
Mid-way through code block |
The following code:
:html => {:id => 'enrollment_form'}
Should be:
{:id => 'enrollment_form'}
*remove the :html =>
Note from the Author or Editor: Correct.
|
Josh Pinter |
Mar 06, 2010 |
|
Printed |
Page 278
End of 3rd paragraph |
Says:
Note from the Author or Editor: Replace "In both controllers, course_add and course_remove, the old concluding line:" with "In both the Student controller's actions course_add and course_remove, the old concluding line:"
|
Rob Levin |
Jul 06, 2009 |
|
Printed |
Page 278
Last paragraph, 3rd line from bottom |
The text:
"...whose name matches the controller and whose extension is .rjs."
Should be:
"...whose name matches the controller method name and whose extension is .rjs."
*It's the controller method name, not just the controller
Note from the Author or Editor: Yes, that's a good clarification.
|
Josh Pinter |
Mar 06, 2010 |
|
Printed |
Page 278
Last paragraph, 2nd line from bottom |
The text:
"In this case, that would be course_add.rjs and course_remove.rjs, two similar files shown in Examples 16-4 and 16-5."
Should be:
"In this case, that would be course_remove.rjs and course_add.rjs, two similar files shown in Examples 16-4 and 16-5, respectively."
*For clarity, 16-4 shows course_remove.rjs and 16-5 shows course_add.rjs
Note from the Author or Editor: Sorry - got these backwards.
|
Josh Pinter |
Mar 06, 2010 |
|
Printed |
Page 279
First indendted bullet point 2/3 down the page |
page << "alert("I entered this code myself")
inconsistent quotation marks and no closing quote for the whole alert. This worked:
page << "alert('I entered this code myself')"
Note from the Author or Editor: Please change page << "alert("I entered this code myself") to page << "alert('I entered this code myself')"
|
Rob Levin |
Jul 06, 2009 |
|
|
295
Example 17-10 |
Its also in the Online and likely PDF version.
Found two issues.
The first issue is that, if you install Inline Attachments (which is now called something else) as a gem, you need to explicitly enable it in config/environments.rb:
config.gem 'JasonKing-inline_attachment', :lib => 'inline_attachment'
Otherwise, you get a NOMETHOD message.
Otherwise, you have to install it as a plugin:
script/plugin install git://github.com/JasonKing/inline_attachment.git
The other issue is that calling render_message and passing in award => award parameter will return a:
You have a nil object when you didn't expect it!
The error occurred while evaluating nil.name
It appears that like @cid, you have to set award object as an instance variable:
@award = award
and so. . .
part 'multipart/related' do |p|
p.parts << ActionMailer::Part.new(:content_type => 'text/html',
:body => render_message('certificate.text.html.erb',
:award => @award, :cid => @cid))
Not sure if it was the change in inline_attachment code or the Rail version change that caused it or just an oversight. Considering the last couple errata I have submitted, I am inclined to believe the last one one. :)
(No, I won't hold it against you. Trying to figure out the bugs actually helped me out in learning rails, so its all good, as they say in the South. Thanks for a great publication!).
Note from the Author or Editor: I believe this is correct, but fortunately the Rails 3 changes to ActionMailer have made this particular instability go away.
|
Rilindo Foster |
Jul 25, 2009 |
|
Printed |
Page 295
Example 17-10 |
Follow up on Example 17-10.
Actually, I forgot to mention that I tested it on the older Inline_attachment versions (0.3.0 n3 0.4.0), so it likely not InlineAttachment that is the issue, but I could be wrong. . .
Note from the Author or Editor: I believe this is correct, but fortunately the Rails 3 changes to ActionMailer have made this particular instability go away.
|
Rilindo Foster |
Jul 25, 2009 |
|
Printed |
Page 319
Figure 18-4 |
Figure 18-4 should show an empty list of students (instead of the listing with student 'Dylan Wonkatoni Chazwick').
Note from the Author or Editor: This is correct, and I'll need to submit a new figure. I'd originally meant to show more of the application running, and apparently deleted the wrong figure.
|
K.Oster |
Feb 25, 2009 |
|
Printed |
Page 333
Paragraph under Variables, Methods, and Attributes |
on line 3, where it says "and visit http://localhost:3000/testbed/", it should make clear that you also need to add 'testbed' to the end of whatever URL Heroku gives you after you press the >> button.
Note from the Author or Editor: Please add a sentence after "a mostly blank response." that says:
(In Heroku Garden, you may need to add 'testbed' right after the URL that Heroku Garden sends you to when you've pressed >>.)
|
Simon St. Laurent |
Feb 10, 2009 |
|
Printed |
Page 337
2nd paragraph |
At start of 2nd paragraph: "When index is called, is sets..." should be "When index is called, it sets..."
Note from the Author or Editor: Correct. Please change "When index is called, is sets" to "When index is called, it sets" .
|
Jonathan Hironaga |
Jun 20, 2009 |
|
Printed |
Page 341
list of operators |
**:
Note from the Author or Editor: Please change "less then yields" to "less than yields" and "10**4 is 1000" to "10**4 is 10000"
|
j hiro |
Jun 20, 2009 |
|
Printed |
Page 342
3rd line of 3rd paragraph |
Text reads:
"For evaluation purposes, anything except for false or 0 or nil will evaluate to true."
0 evaluates to true
Note from the Author or Editor: This is correct. Please remove "or 0".
|
Boyd Brown |
Jan 09, 2010 |
|
Printed |
Page 346
at the bottom of the page |
def index
my_array = [5,4,3,2,1]
@result = ''
for i in *myArray*
@result = @result + i.to_s + ""
end
end
The myArray variable should be my_array.
Note from the Author or Editor: This is correct. Please change myArray to my_array.
(For consistency, please make that change throughout the appendix.)
|
Anonymous |
Sep 10, 2009 |
|
Printed |
Page 352
2nd paragraph, 5th line |
Note from the Author or Editor: Please change "managed related" to "manage related".
|
j hiro |
Jun 20, 2009 |
|
Printed |
Page 359
code after 3rd paragraph |
sentence =~ /Ruby/
# => 2 - There are two instances of
Note from the Author or Editor: Please change '# => 2 - There are two instances of "Ruby".' to:
# => 0 - The first instance of 'Ruby' appears at position 0.
|
j hiro |
Jun 20, 2009 |
|