By Developers, For Developers

Historical errata for Rails for Java Developers

" leaving unclosed “td” elements in the html if I am not mistaken.

PDF PgPaper PgTypeDescriptionFixed onComments
lastERROR

The websites under ‘visit us online’ are not clickable in the PDF. Would be convenient to have them click through to the website rather than cut/pasting

(Dave says: great idea!)

2006-10-25
3TYPO

The example code line: script/generate model Person
I believe, should read: ruby script/generate model Person
I am using Windows XP Pro.

2006-11-28
51ERROR

“The code in Figure 3.1 causes nil.blank? to return false.”

While the code seems to be at odds with that statement:

class NilClass #:nodoc:
def blank?
true
end
end

Thanks!

2006-11-28
55ERROR

"Ruby

2006-11-28
1TYPO

Like Insant Rails on Windows …
should read: Like Instant Rails on Windows …

2006-11-28
7TYPO

http://www.ruby-doc.org/ ruby Core documentation
Should read: http://www.ruby-doc.org/core ruby Core documentation

2006-11-28
22TYPO

Instructions for downloading the sample code are in Section ,
Should read: Instructions for downloading the sample code are in Section ?,

2006-10-25
65TYPO

Calls to isBlank( ) need to return false for nullStrings.
Should read: Calls to isBlank( ) need to return false
for null Strings.

2006-11-28
76TYPO

m.write_test_plans 5
m.code 3
m.debug 6
m.run_tests 2

should read:
m.write_test_plans 5
m.code 3
m.run_tests 6
m.debug 2

2006-11-28
91TYPO

production once you are confident that everything works propertly.

Should read: production once you are confident that everything works properly.

2006-11-28
94TYPO

With just the three lines above, you
how have full-functioning …

should read:
With just the three lines above, you
have full-functioning …

2006-11-28
109TYPO

The call to save(person) poses an an interesting question.

should read:

The call to save(person) poses an interesting question.

2006-11-28
116TYPO

… one trip to get the people, and then then N more trips …

should read
… one trip to get the people, and then N more trips …

2006-11-28
145TYPO

Most programming environments include a basic tool for this kind of of automation.

should read

Most programming environments include a basic tool for this kind of automation.

2006-11-28
149TYPO

On line , STATS_DIR is a Ruby constant , and it can be …

should read:

On line 1, STATS_DIR is a Ruby constant, and it can be …

2006-11-28
106TYPO

The email that went out today said there’s a new chapter on actionview, but the PDF I generated contains just a title page for that chapter.

“Chapter 5 (Rendering Output with ActionView) is new”

2006-11-28
15TYPO

The sample code I downloaded did not have a config directory in the java_xt folder, as referenced in the text.

2006-11-28
67TYPO

In describing the cast to Employer of the stu variable, the code is right but the text describes a cast to Employee prior to calling the addEmployee method.

2006-11-28
68TYPO

I think this is a typo…
Text is “In the Ruby version, a stu who could add_employee some Employee would result in an exception.”

Believe intent is “who could NOT add_employee”?

2006-11-28
74TYPO

Third para from the bottom:
presumable should be presumably

2006-11-28
2TYPO

section 1.2 starts Wwith Rails you can build an simple web…

“an” should be “a”

2006-11-28
37ERROR

the final (third) case example returns A-F when A-F is input. there is no grade ‘E’ though. also, the ranges 80..90, 70..80, and 60..70 might be better expressed as 80…90, 70…80, and 60…70, although the code is correct with the former

2006-11-28
39SUGGEST

you mention coding standards here in a side bar. another one that might be worth mentioning, especially since it differs from java, is the idea that ruby favors variable names a la ‘variable_name’ vice ‘variableName’ - the latter i know is called camel case, dunno about the other…

2006-11-28
50TYPO

The link at the bottom of the “Checked Exceptions: Feature or Flaw?” box is broken (“//http://www.mindview.net/Etc/Discussions/CheckedExceptions”). The URL is fine when you remove the slashes at the beginning.

2006-11-28
63TYPO

The final sentence in the paragraph right before section “3.5 Delegation” reads “Rails includes rake tasks for managing how your applications dependencies on Rails itself; see Section 7.4, Controlling Which Version of Rails You Use, on page 183 for details.”. I think the part before the semicolon should be rephrased as something like: “Rails includes rake tasks for managing how your applications depend on Rails itself;”.

2006-11-28
64TYPO

In the box “How does require_gem work?”, the paragraph before the last one ends with the sentence: “Likewise, the calls to ObjectSpace show that loading them gem brought in 110 new classes.” I think “them gem” should be replaced with “the gem”, or possibly “the pdf-writer gem”.

2006-11-28
94TYPO

The second paragraph below the first code sample: “Instead, a SaveOrUploadEventListener interface acts as a hook for all save or load events on the session.” contains the term “SaveOrUploadEventListener” while the code sample is about extending a “DefaultSaveOrUpdateEventListener” (Update instead of Upload). I think this might be a typo.

2006-11-28
96TYPO

The second sentence in the paragraph below the header “One to Many Relationships” contians a double “the” before the words “primary key” (“The second table has a foreign key column which refers to the the primary key in the first table.”).

2006-11-28
111TYPO

The last sentence of the first paragraph in section “5.1 Creating Basic .rhtml Files”, “Here is a Hello, World page that includes your name (if it was a available in the query string).” contains an “a” that shouldn’t be there in “a available”.

2006-11-28
118TYPO

The fourth sentence of the first paragraph ("The text_field method takes two arguments here. Rails combines the two arguments to create a parameter name, so text_field

2006-11-28
118TYPO

Line 6 in the code sample on the lower half of the page ("

“) contains the word ”Passsword" instead of “Password”. Besides this, lines 4, 6 and 8 in the code sample do not end with "

2006-11-28
119TYPO

At the end of the previous page and the beginning of this page a number of helper methods (on line 7 and line 9 in the code sample on page 118) are said to have four arguments. Those methods have only three arguments as far as I can tell.

2006-11-28
119TYPO

The “td” elements for the labels in the code sample are not closed. (This is the same issue as in the code sample on page 118).

2006-11-28
130TYPO

The second to last sentence on this page ("We don

2006-11-28
186TYPO

In the last sentence of the first paragraph (“As an example, we will create an better search action called better_search.”), “an better” should be “a better”.

2006-11-28
187TYPO

In the second sentence below the first code sample (“Rails then generates JavaScript to replaces the contents of each DOM id with the result of rendering the partial.”), “replaces” should be “replace”.

2006-11-28
144TYPO

There is a caps lock issue in the start of the last sentence on this page: “hERE IS A Filter that will log the request URI before dispatching the request.”

2006-11-28
146TYPO

The second to last paragraph on this page contains the sentence “ApplicationController is a base class for all controllers, so methods declared their are available to all controllers.” in which “their” should be “there”.

2006-11-28
197TYPO

The assertion in the SelfDocumentingTest java code will fail, not only because of capitalization, but also because "

" is expected instead of "

“: ”assertEquals(“tag should lowercase element names” , "

" , Simple.tag(“H1” ));".

2006-11-28
197TYPO

In the first sentence of the last paragraph, "Next, let

2006-11-28
205TYPO

The text in the sideline at the right bottom corner of the page does not look very nice, I think this is because it is missing some spaces: "

2006-11-28
165ERROR

Couple things,

1.) The code seems to be out of date with the book. I downloaded the latest code package and it doesn’t have a filtered_show.rhtml file in code/rails_xt/app/views/quips/

2.) Is the code listing correct? I was assuming that you have to include a call to the bfl method somewhere in the rhtml file. If it’s done automatically can you note that somewhere in the text of the preceeding paragraph?

2006-11-28
186ERROR

Section 6.9 describes and RJS example, but the downloadable code does not include files from the example. better_search.rhtml and _search_count.rhtml are missing. Others likely missing too, but no time to list each one.

2006-11-28
19SUGGEST

For instant rails user should first run use_ruby.cmd to setup the dos environment.

2006-11-28
20SUGGEST

before the script/generate command - reinforce the fact that user needs to be in people directory

2006-11-28
21SUGGEST

Sorry to be stickler for details…before scaffold generation command you should indicate to the user that they should go back to people directory

2006-11-28
224TYPO

In the second sentence of the last paragraph, “The template expects a Person to implment various accessors, and to return a working errors property.”, “implment” should be “implement”.

2006-11-28
226TYPO

About halfway the page, in the sentence "This is fortuitious, since Rails applications need good tests

2006-11-28
232TYPO

The last sentence on this page starts with “On line 1, STATS_DIR is a Ruby constant, and it can be passed”. In the code sample the constant is named “STATSDIR” (without the underscore).

2006-11-28
234TYPO

The second sentence of the last paragraph starts with "In English, this line says

2006-11-28
160SUGGEST

This might be a bit far-fetched, but it would be nice if text fragments containing a #-sign for indicating a method with a class were not formatted as if the #-sign was used for starting a comment. An example can be seen in the output fragment starting with: “Processing AccountController#login (for 127.0.0.1 at 2006-10-31 13:05:04) [POST]”, where the part from “#login” is colored green.

(Dave says: our syntax highlighter has problems with some Ruby constructs. Sorry)

2007-01-04
242TYPO

In the text below point number 3, I think there should be a period behind the sentence ending in “thereof”. ("thereof (If they didn

2006-11-28
243TYPO

In the first sentence of section 9.1 I think the word REST had better be written in capitals, as it is further on in the text. “One of the keys to rest is viewing the web as a collection of resources resources (see the sidebar, on page 249 for more details.)”

2006-11-28
244TYPO

In the first paragraph below the code sample for authors_controller.rb, there is mention of “wants.xml” and “wants.html”, while the code sample uses “format.xml” and “format.html”.

2006-11-28
249TYPO

In the second sentence of the paragraph below point 2 (“The standardized CRUD interfaces is friendly to caches and layered systems.”) I think it should mention that the “CRUD interface is friendly” (singular form of interface).

2006-11-28
250TYPO

In the first paragraph “localahost:3000/authors” should probably be “localhost:3000/authors”.

2006-11-28
253TYPO

In the second sentence below point 5 (“Much of the code is boilerplate, so one you have done it once you can reuse it on other projects.”) I think the fragment “so one you have done it once” should be replaced by something like “so when you have done it once”.

2006-11-28
265TYPO

In the second sentence (“Instead, the elements( ) method returns an object that support XPath.”) “support” should be “supports”.

2006-11-28
269TYPO

The code sample for dom_output.rb shows the use of a “write” method, while the sentence below the sample (“The call to print( ) takes an optional second argument which sets the
indentation level.”) mentions a call to “print( )”.

2006-11-28
273TYPO

Section 9.10 ends with the remark: “This vision, known as web services, is the subject of the next chapter.” I think this is a left-over from one of the previous versions of the book where the XML part has been in a chapter before the web services part, as chapter 10 now is about security.

2006-11-28
273TYPO

The link for the URL mentioned for Builder Objects doesn’t work properly (file:///… instead of http://…)

2006-11-28
274TYPO

The link for the URL mentioned for REXML doesn’t work properly (file:///… instead of http://…)

2006-11-28
277TYPO

In the second paragraph of the “Installing the acts_as_authenticated Plugin” box, it says: “acts_as_authenticated is such a plugin, so all you have to do enter the following two commands.”, where “all you have to do enter” should be replaced by something like “all you have to do is enter”.

2006-11-28
278TYPO

The second to last paragraph of section 10.1 ends with a sentence that starts with: “Depending on you policy for new account creation,”. I think this should be: “Depending on your policy for new account creation,”.

2006-11-28
58TYPO

Comment in code sample:

  1. don’t to this—use attr_accessor!

Should be:

  1. don’t do this—use attr_accessor!
2006-11-28
82TYPO

Method calls are dynamically dispatched to a specify
implementation, based on the type the object used to call the method.

Should read:

Method calls are dynamically dispatched to a specific
implementation, based on the type the object used to call the method.

2007-01-04
294TYPO

At the end of #6, the example of how person.rb should be rewritten is identical to the code demonstrating the injection flaw.

2007-01-04
298TYPO

In the last paragraph of 10.4, I believe the fourth sentence (“In particular, no code alone cannot resist a determined attacker.”) contains one denial too many. I think it should probably be rewritten as: “In particular, code alone cannot resist a determined attacker.”

2007-01-04
302TYPO

In the Java To Ruby Dictionary the item “static method” says: “Ruby provides several ways to declare class-level methods. See Section 2.3, Objects And Methods, on page 42”. I might have overlooked something, but I cannot find any explicit explanation of how to define static methods in ruby.

2007-01-04
306OK

I don’t know if this is intentional, but the index is empty.

2007-01-04
235TYPO

The description doesn’t match the code - line one has STATSDIR and the description says STATS_DIR

2007-01-04
247SUGGEST

This is probably just a lack of understanding on my part, but the code has format.html and format.xml while the description refers to wants.html and wants.xml. The “wants” look like code so should the code block actually be wants instead of format? Or is this simply an “understood” conversion in the Rails space?

2007-01-04
269TYPO

Missing space between (BFUD) and often

2007-01-04
269SUGGEST

Probably shedding more light on my lack of knowledge, but what is BFUD? You’ve defined BUFD so is that a type or does it have special insider meaing? Along those lines, I’m not so sure that sentence reads right…

2007-01-04
275TYPO

Is Google as a verb lower cased? I recon so, just wanted to check…

2007-01-04
287TYPO

“In order to get out tests to pass” should read “In order to get OUR tests to pass”

2007-01-04
25TYPO

“If the user sends a search team,” - last word should be “term”

2007-01-04
18ERROR

Darwinports is now in the process of being replaced with macports. You might want to mention this. The only problem is that mac ports doesn’t, at this time, have a binary download like darwinports.

2007-01-04
20SUGGEST

Do you plan to add download links like the Agile Web Development w/ Rails book?

44TYPO

The sentence before 2.4 Collections and Iteration is missing the reference. “See for a few examples”, see what?

43SUGGEST

The paragraph in question contrasts Ruby’s dynamic typing with Java’s static one. The word “also” seems out of place in the phrase “Java also provides static typing”.

61TYPO

The book has:
Ruby provides two equivalent methods: == and .eql?.
(Why two methods? See .)

The reference to the soapox is missing. Also, the example just above uses .equal? not .eql?. This dual use could be better explained.

77SUGGEST

The classpath in the Java command uses Unix separator character, “:”. You may want to mention that Windows version of this command will use “;” as a separator.

95ERROR

When running the rake command using Rail 1.2.1 you get the following message:
Illegal route: the :controller must be specified! (ArgumentError)

They change the RouteBuilder

105TYPO

In the phrase “it can contain as any number of named parameters”, word “as” appears to be superfluous.

144TYPO

hERE IS A Filter

146TYPO

I do not suppose you meant “nothing” in the sentence “It is worth nothing that servlet filters…”.

167SUGGEST

I would expect the sample at the bottom of the page to refer to the tag created above. There is no such reference, however.

178TYPO

Repeated “an” in “When Rails first renders an an action that is page cached”.

178TYPO

It should probably be “at all” in “Subsequent requests for the page do not encounter Rails as all”.

189TYPO

This sentence needs to be corrected: “Rails then generates JavaScript to replaces the contents of each DOM id with the result of rendering the partial.”

13SUGGEST

You say this:

This is a book about two worlds: the world of Java programming and the
world of Rails programming. Whenever worlds collide, you can expect
to hear things like “Java sucks, and Rails rocks…” (or the reverse).

You won

59TYPO

spelling mistake: You have “responbility” and it should be “responsibility”

62ERROR

The code from code/rails_xt/samples/programmer.rb (dated 11/28/06) doesn’t run because it’s missing the following at the top of the source code:

require ‘person’

85SUGGEST

Can you show the Ruby classes so that one can compare these to the Java classes shown on previous page? This would help to see the difference of approach.

86SUGGEST

How about showing a simple example of duck typing. Theory is nice but concrete examples really help.

245TYPO

Use “are” not “is” in
“The standardized CRUD interfaces is friendly to caches and layered systems.”

304SUGGEST

Appendix with postgresql(account and password) setup.

101SUGGEST

You should show somewhere that on InstantRails - in dos command window - one would have to type (after running the InstantRails’ use_ruby.cmd to get the environment correct):
ruby script/generate migration create_quips
rather than the unix:
script/generate migration create_quips

105TYPO

>>ended< is wrong. It should be:
>>end

105SUGGEST

You totally hose up anyone who is trying to follow the example by having them migrate schema to version 0 so tables are wiped, then having them do operations on the tables via code on this page.

98ERROR

The rake task migrate has been deprecated. Should be “rake db:migrate”.

79ERROR

To fix the error listed at #6143, just change the line
map.connect ‘people/:action/:full_name’
to
map.connect ‘people/:action/:full_name’, :controller=>‘people’

74TYPO

“function” has 8 letters rather than 7 (if that is the “seven letter f-word” mentioned).

43TYPO

Book:
irb(main):025:0> “Hello”[1,4]
=> “ello”

Should be:
irb(main):011:0> “Hello”[1-4]
=> 108

58TYPO

Book:
class Person

Should be
class Person end

Note. “end” never appeared in the book for this class

98ERROR

I am still having problems with the rake migrate. I added to map.connect
‘people/:action/:full_name’, :controller=>‘people’
Now it is indicating “Bad file descriptor - connect(2)”
I did a —trace but there were not enough details to determine what command was executing when the error occured.
Ray Hooker
rhooker@cisco.com

73ERROR

assert nil.blank?
fails.

73SUGGEST

Method blank? definition
instead of
empty? || strip.empty?

strip.empty?
does the same job.

5SUGGEST

Page 5 illustrates automated testing for the People application

Running rake will fail (at least on my setup) as the first record, defined as “first” in the people_controller_test.rb, line 15: people(:first).id, differs from the people.yml, which declares the first record as “one”.

Change the “first” in people_controller_test.rb to “one” or change the “one” in people.yml to “first” will get the automated test to work.

I’m using InstantRails 1.6 on Win XP system

79ERROR

Tried the ‘rake migrate’ and rake ‘db:migrate’ as well, but getting the same error:
“Illegal route: the :controller must be specified!”

Any idea what to do with this missing controller?

cadima@mac.com

31ERROR

When executing “script/console” the error occurs on macosx 10.4 (maybe should be mentioned how to solve).

=> Booting WEBrick…
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:965:in `build’: Illegal route: the :controller must be specified! (ArgumentError)
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1172:in `add_route’
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:986:in `connect’
from ./script/../config/../config/routes.rb:27
from ./script/../config/../vendor/plugins/selenium_on_rails/switch_environment/init.rb:19:in `draw’
from /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/routing.rb:1139:in `draw_without_selenium_routes’
from ./script/../config/../vendor/plugins/selenium_on_rails/switch_environment/init.rb:15:in `draw’
from ./script/../config/../config/routes.rb:6
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in `load’
… 19 levels…
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in `new_constants_in’
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in `require’
from script/server:3

252TYPO

In the irb listing is an > instead of > (I hope this doesn’t get messed up when I submit it..)

19ERROR

The class TestPrimitives does not compile, because in the method, on line 1.:

0. public void testSomeLegalConversions() {
1. assertEquals(2.1, 2 + 0.1);
2. assertEquals(“B12”, “B” + 12);
3. }

The method assertEquals(double, double) does not exist.

135ERROR

The download link does not work.
Also, the routing code on page 135 DOES NOT CONTAIN the code that is described in the surrounding text.

Take pity on us bleating of a Rails noob!

- Jason Ziegler

PS: I LOVE this error-reporting interface and especially its integration into the PDF. Thank you!

12ERROR

When running ‘ruby script/console’, I got the following error:

./script/../config/boot.rb:43:Warning: require_gem is obsolete. Use gem instead

When I changed that boot.rb file accordingly, the warning was no longer there

154TYPO

Ruby on Rails layout templates are .rhtml files, not html. Therefore:

… a template named app/views/layouts/foo.html
should be changed to
… a template named app/views/layouts/foo.rhtml

… a template named app/views/layouts/application.html
should be changed to
… a template named app/views/layouts/application.rhtml

168TYPO

There are some syntax errors in the following two files:

code/rails_xt/app/views/layouts/quips.rhtml
code/rails_xt/app/views/quips/list.rhtml

I had to remove several lines with “<%”. Once I did that both files compiled correctly.

21ERROR

The “Rails App in Fifteen Minutes” section fails badly with Rails 2.0. I discovered the change in database configuration, and was able to change it to point to a MySQL server (unnecessarily). If you progress that far, once browsing to localhost:3000/people, you get a 404 page:

Routing Error

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

An associate directed me to downgrade Rails to version 1.2 to continue a match with the book.

24ERROR

The sample scaffold app “people” doesn’t successfully execute tests with a rake command in rails 1.2.6. It generates eight errors as follows:

StandardError: No fixture with name ‘first’ found for table ‘people’

I don’t know the solution. :(

169TYPO

hello.jsp: request.name should be param.name. I don’t believe request.name works.

30TYPO

Functions that use blocks for iteration tend [to] pass one or two parameters to the block… in 3rd to last paragraph. Thanks.

62SUGGEST

Unlike Java [source files], Ruby [source files are] not class-oriented

118SUGGEST

Line numbers helpful here, similar to the lines numbers shown on p.102. Thanks.

Categories: