By Developers, For Developers

Historical errata for Crafting Rails Applications

PDF PgPaper PgTypeDescriptionFixed onComments
2TYPO

“If you’re a intermediate…” should read “If you’re an intermediate…”

2010-12-11
8TYPO

“customize render toaccept :pdf as…” should read “customize render to accept :pdf as…”

2010-12-11
29TYPO

“information sent through a form in the controller and delivery it to a recipient” should be “information sent through a form in the controller and deliver it to a recipient”

2010-12-11
31BSUGGEST

Before we run our test suite again, we need to ensure that MailForm::Base is loaded.

Technically test passes even without autload stuff because MailForm::Base loads the Base.

2010-12-11
13ERROR

After a clean ‘enginex pdf_renderer’ command i was not able to call ‘rake -T’ as talked about on page 13. I got the error:

“Could not find gem ‘ruby-debug (>= 0.10.3, runtime)’ in any of the gem sources listed in your Gemfile.”

I had to call ‘bundle install’ before the ‘rake -T’ task. (The bundle install command is atm introduced at page 15.)

2010-12-11
38ERROR

the method ‘persisted?’ does not belong in the listing here yet.
On page 39 it’s introduced as a response to the encountered test failure with the message ‘The model should respond to persisted?’. (it’s added on page 40)

If readers type this method over while walking through the chapter they will not see the test fail as described on page 39-40.

2010-12-14
9TYPO

In the last sentence of the last paragraph, I think

“you’ll should read the chapters in the order they are presented.”

should be

“you should read …”

2010-12-11
168TYPO

footnote URL has a double http prefix and the link itself is broken.

2010-12-14
147TYPO

See first bullet point:
“An application is responsible for all bootstraping”, typo in bootstrapping. (missing a ‘p’)

2010-12-14
149SUGGEST

Bullet point with “I18n::Backend::ActiveRecord”: i think it’s not really clear for most readers what you mean with ‘(deprecated since 0.5 versions)’ because it’s not really clear you’re talking about the vendored I18n gem inside rails.

2010-12-14
149TYPO

In the bullet points below, in the first one starting with “I18n::Backend::Cache”.
It’s missing an opening bracket. (It only has a closing bracket)

2010-12-14
24TYPO

Paragraph just above the bullets:

“Action Controller furthers extends”

“furthers” should be “further”

2010-12-14
80ERROR

First line: “When we run the test suite, our new test passes”
No, it doesn’t until you run “bundle install”

2010-12-14
79SUGGEST

It might be worth mentioning at the start of the chapter that RDiscount does not work on Windows

2010-12-15
7TYPO

3rd graph 4th sentence: Then there are those developers that prefer RSpec to [u]of[\\u] Test::Unit.

remove extraneous “of”

2010-12-14
8TYPO

Says “customize render toaccept :pdf as an option” - needs a space ‘twixt “to” and “accept”. There may BE a space in the XML, but something about the fact that both ’render’ and ‘:pdf’ are in a different style may be eating it.

2010-12-15
8TYPO

Says “receives data through a form and send it to ” - should be “sends”, not “send”

2010-12-15
147TYPO

In the paragraph below the code sample; “This means an application can do everything an engine do, plus some specific behavior.” I think it has to be ‘… an engine does, … ’.

2010-12-15
154ERROR

On page 154 the reader has to implement the Translator reload! class method but it’s already implemented/described in the code sample at page 151.

2010-12-15
45ERROR

Using Ruby 1.9.2 the error described does not occur (ArgumentError: wrong number of arguments (1 for 0))

Was banging my head against my desk trying to figure out which model included an initialize method until I discovered BasicObject#initialize snuck into Ruby 1.9. Talk in ruby-lang was that it will be removed until 1.9.3

2010-12-15
133ERROR

in the bottom source code sample; require “responders/http_cache” and include HttpCache should be left out. They are created on follow up pages and make the tests fail at this point. (i think this is a recurring problem with a lot of code samples, i guess this is some automation bug?)

2010-12-16
131SUGGEST

Maybe you could dedicate a paragraph in this chapter to configuring custom Responders to single (or a set of) controllers instead of global application usage.
For example, if you only wanted to use the cache responder as developed in this chapter in the users controller you could use:

class UsersController < ApplicationController
self.responder = Responders::MyCustomHttpCacheResponder

end

Is there also an easy way to configure the written Responder engine to globally hook or not? (Could be extra info on the above)

2010-12-16
147TYPO

bootstraping > bootstrapping

2010-12-16
36TYPO

test below is already added in code shown on page 34

Let’s add a small test case to our suite showing these methods and what they return:

Download mail_form/4_compliance/test/compliance_test.rb
test “model_name exposes singular and human name” do
assert_equal “sample_mail” , model.class.model_name.singular
assert_equal “Sample mail” , model.class.model_name.human
end

2010-12-16
7TYPO

“Then there are those developers that prefer RSpec to of Test::Unit.”

It should be “to” instead of “to of”.

BTW there was no report erratum link on page 7 :)

2010-12-16
76ERROR

Source for handlers/test/dummy/app/controllers/handlers_controller.rb should include an index action to get the test failure described on page 77

class HandlersController < ApplicationController
index
end
end

2010-12-17
80TYPO

should be
test ‘.merb template handler’ do
not
test ‘.erb template handler’ do

2010-12-17
98ERROR

I am running Ubuntu 10.10 64bit after installing Mongo from the Ubuntu repositories I had to use mongo and bson_ext version ‘1.1.5’ gems to get mongo to work

2010-12-21
13SUGGEST

rake -T is suggested as a command before bundle install. Calling rake before bundle install triggers errors, e.g., missing Capybara and other gems. Perhaps have the reader call bundle first (and for newbies indicate that they should cd into pdf_renderer).

2010-12-20
9494TYPO

… but the application has the final world about it.

world -> word

2010-12-20
85TYPO

There are two references to page “??”. Page number is missing.

2010-12-29
82SUGGEST

Instead of using email.parts[0] and email.parts[1], email.text_part and email.html_part would be clearer to understand

2010-12-20Thanks for the suggestion. The order is important to assert, otherwise some clients won't show the HTML part properly. I changed the text to add this observation.
PrefaTYPO

Then there are those developers who prefer RSpec to —of— Test::Unit.

2010-12-22
31TYPO

There is a small grammar issue with the “we annotates” bit of the following:

“So when we want to load MailForm we annotates that it has a constant called Base which is defined in mail_form/base.rb.”

I would phrase it like the following:

“So, when we want to load MailForm, we note [annotate] its constant Base. Base is defined in mail_for/base.rb.” or something like that.

2010-12-25
39ERROR

The method persisted? is already defined on page 38. It should be removed on page 38 to provide the link flow on page 39.

2010-12-29
7TYPO

If you’re a intermediate
s/a intermediate/an intermediate/

2010-12-29
8TYPO

This chapter starts a series of discussion
s/discussion/discussions/

2010-12-29
9TYPO

and expose them for further analysis through a web interface.
s/expose/exposes/

2010-12-29
9TYPO

Capybara’s’
extra apostrophe

2010-12-29
12TYPO

we modify the render method to accept :pdf as option
s/option/an option/

2010-12-29
12TYPO

as we will see in next chapters.
s/next/the next/

2010-12-29
21ERROR

It seems to be a problem when adding the new pdf_rederer. When I run the tests I get the following error:
ActionView::MissingTemplate: Missing template home/index with {:handlers=>[:erb, :rjs, :builder, :rhtml, :rxml], :formats=>[:pdf], :locale=>[:en, :en]} in view paths “path/to/views…”

This line is causing the error:
pdf.text render_to_string(options)

I think it is trying to render a template when the “render_to_string” method is called, because when I remove the method call in this line, the test passes.

nice book José, congratulations.

2010-12-29
87ERROR

The problem #46064 was changed to page 87: two ocurrences of ‘??’ references

2010-12-29
115ERROR

config.sql_metrics.mute_middleware = %r{^/admin}

should probably read as

config.sql_metrics.mute_regexp = %r{^/admin}

2011-01-05
125ERROR

The table is not fitting in the PDF page

2011-03-14
1717ERROR

Before to be able running “rake test” the “bundle install” should be run. Because the audience is intermediate or advance developers this is not a big deal, but I should mentioned this.

2011-01-12
147SUGGEST

I just finished translating my Rails app into 8 different languages. The I18n stuff is fantastic, but the manual translation is not fun. You might want to mention services like Wordchuck that can auto-submit your language files to Google Translate. If you want them professionally reviewed & translated, they can do that too. I used it to translate our payment pages into 8 languages with a few clicks.

2011-01-12
17SUGGEST

At the point of running rake test an error occured saying
Could not find gem ‘capybara (>= 0.4.0, runtime)’ in any of the gem sources listed in your Gemfile.
Obviously this is an advanced book and most people reading this ought to know that running bundle install in the pdf_renderer folder will install the dependencies needed that enginex requires but for completeness sake a short one liner after the enginex pdf_renderer command to generate the pdf_renderer gem might be a nice touch.

Also wondering why enginex at all? Perhaps I’ll post in the forum about that.

2011-02-08
103TYPO

When moving the model to the app/models folder the module declaration for SqlMetrics needs to be removed.
If this is not removed then when you run the dummy app as outlined on Page 107 and visit /sql_metrics the error

LoadError (Expected /home/jamie/Development/rails/sql_metrics/app/models/metric.rb to define Metric):

(I’m uing ruby 1.8.7 Rails 3.0.3)

However if you remove the module declaration the gem tests fail but the app works!

2011-02-08
103ERROR

When moving the model to the app/models folder the module declaration for SqlMetrics needs to be removed.
If this is not removed then when you run the dummy app as outlined on Page 107 and visit /sql_metrics the error

LoadError (Expected /home/jamie/Development/rails/sql_metrics/app/models/metric.rb to define Metric):

(I’m uing ruby 1.8.7 Rails 3.0.3)

However if you remove the module declaration the gem tests fail but the app works!

2011-02-08
28TYPO

When it says “ActionController::Rendering: It overrides render to check whenever”, shouldn’t it be AbstractController::Rendering?

2011-02-08
19TYPO

“we haven’t formally described what is
a renderer”

Placement of verb. Consider changing to “we haven’t formally described what a renderer is”

2011-02-08
96TYPO

2nd to the last paragraph, 2nd sentence.

…customizing them in the same we configured the mailer…
should be
…customizing them in the same WAY we configured…

2011-02-08
108TYPO

2nd to the last paragraph
…Rack came out proposing AN unified API.
should be
…Rack came out proposing A unified API.
because unified is pronounced yoo-nified (i.e. begins with a consonant)

2011-02-08
112TYPO

2nd paragraph
Rails 3 lets us middleware inside…
probably should be
Rails 3 lets us USE middleware inside…

2011-02-08
57TYPO

On “From the normalized
arguments, we create an SQL statement and query the database.” it should be “From the normalized
arguments, we create a SQL statement and query the database.”. (an SQL statement => a SQL statement)

2011-02-08
141TYPO

First paragraph after the code snippet. First sentence doesn’t fit in the pdf.

2011-03-14
30TYPO

3rd paragraph from end; second sentence “in” should be “on” i.e.

Since Rails itself relies in this well-defined stack to extend Action Controller
=>
Since Rails itself relies on this well-defined stack to extend Action Controller

2011-02-08
35TYPO

Second Paragraph from the end; second sentence replace “do” with “to”
i.e.
But what if we want do define both prefix and suffix at the same time?
=>
But what if we want to define both prefix and suffix at the same time?

2011-02-10
44SUGGEST

Where: Download mail_form/6_delivery/lib/views/mail_form/notifier/contact.text.erb

It is not clear from the text or the above path where this should be added.

The correct complete path should be:
mail_form/lib/views/mail_form/notifier/contact.text.erb

I initially interpreted the path to be:
mail_form/lib/mail_form/notifier/contact.text.erb

Only after consulting the code archive did it become clear what the correct path should be.

Please be explicit where chunks of code should go in the path hierarchy.

13TYPO

The HEading of what is really Chapter 1 create our own Renderer is listed as Chapter 4 Create our own Renderer in the Kindle Version. Location 121-129

99TYPO

On “To subscribe to those notifications, all
we have to do write something like this”, should be “To subscribe to those notifications, all
we have to do IS write something like this”

2011-03-14
109ERROR

The Rack application on this page does not run on Ruby 1.9.2. The error is “Response body must respond to each”. Ruby 1.9 (unlike 1.8) apparently doesn’t provide an each method on string objects.

The Rack Specification states the body value in the environment argument “commonly is an Array of Strings, the application instance itself, or a File-like object”.

A possible fix is to change the following line from this:
[200, { ‘Content-Type’ => ‘text/html’ }, ‘Hello Rack!’] to this:
[200, { ‘Content-Type’ => ‘text/html’ }, [‘Hello Rack!’]]
thus making the body string into an array of strings.

This allows the application to run without error and with no change to the expected output.

160TYPO

3rd code snippet. 2nd line.

.responds_to?(:call)
should be
.respond_to?(:call) -> without the s in respond(s)

35TYPO

Last paragraph. First sentence.

“attributes methods” should be “attribute methods” (i.e. without the s)

or (suggestion)

“Attribute Methods” given you used “Active Record” for ActiveRecord

37TYPO

Third paragraph. Second line.

“generate an unique url” => “an” should be ‘a’

158ERROR

On:

autoload :App, “translator/app”

It should be:

require ‘translator/app’
autoload :App, “translator/app”

The missing require will cause an “uninitialized constant Translator::App” exception on startup.

61TYPO

First sentence after the comma

“some functionals tests” should be
“some functional test” i.e. without the s

61TYPO

The sentence just before the last code snippet:

“Let’s do it by add the following line to UsersController”
should be
“Let’s do it by adding the following line to UsersController”

26SUGGEST

… and it breaks down in two main steps:

would read better as

… and it breaks down into two main steps:

33TYPO

… our first test pass.

should read

… our first test passes.

35TYPO

… uses attributes methods extensively.

should read

… uses attribute methods extensively.

37SUGGEST

… and two other methods required by Active Model as well: …

should read

… as well as two other methods required by Active Model: …

101SUGGEST

“mongo database” should be replaced by “MongoDB database”
“Mongo database” should be replaced by “MongoDB database”

Pages 101(2), 116(2), 117, 118, 119(2)

52TYPO

… keeping an eye in performance.

should read

… keeping an eye on performance.

103TYPO

… but there is not such file …

should read

… but there is no such file …

44ERROR

“After running `rake test`, all tests should be green again”, but they’re not! We’ve now made a template for our mail form to use, but never told it to use it, as far as I can tell. I’m not quite sure where to specify this, either.

63ERROR

“”"
== The Resolver’s Cache
As your learned in the code on page 71 ActionView::Resolver’s find_all method…
“”"

I’m on page 63, so I haven’t read page 71 yet. ;-)

72SUGGEST

“Dual templates rocks!” —there’s a subject-verb disagreement there. Should be “rock.”

74TYPO

First paragraph, last sentence reads “configure it to create .merb templates instead .erb” —probably should be “instead of .erb”

108ERROR

I tried “Hello Rack” application with Rack 1.2.3, which was installed by Bundler for Ruby on Rails 3.0.7. (I understand that the book is based on Ruby on Rails 3.0.3 and maybe it’s using a different version of Rack.)

An error occurred:
ERROR Rack::Lint::LintError: Response body must respond to each

So I enclosed the body string in an array, i.e.:
[200, { ‘Content-Type’ => ‘text/html’ }, [‘Hello Rack!’]]

Then the “Hello Rack” application worked correctly.

64TYPO

To prove that Ruby in fact uses Object#hash to localize entries,..

localize -> locate

142ERROR

Hi,

I may have missed something but when I run “bundle exec rails g responders:install” nothing happens and I have “Could not find generator responders:install.”.

I think the reason is that the new files were not declared in lib/responders.rb (require “responders/install/install_generator”) I then have the following error :
install_generator.rb:3:in `’: uninitialized constant Rails::Generators (NameError)

Perhaps because require “rails/generators/base” is missing in lib/responders/install/install_generator.rb but then I have the following error :
railties-3.0.9/lib/rails/generators/base.rb:228:in `inherited’: undefined method `subclasses’ for Rails::Generators:Module (NoMethodError)

Undoubtedly I missed something, but I am stuck here…

Regards
Alex

22ERROR

latest test run doesn’t pass …

rubyrails:pdf_renderer (ruby-1.9.2@rails310)$ rake test
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
`include Capybara` is deprecated please use `include Capybara::DSL` instead.
Loaded suite /Users/yves/.rvm/gems/ruby-1.9.2-p290@rails310/gems/rake-0.9.2/lib/rake/rake_test_loader
Started
encoding error : output conversion failed due to conv error, bytes 0xFF 0xC3 0xBF 0xC3
I/O error : encoder error
F.
Finished in 0.360567 seconds.

1) Failure:
test_pdf_request_sends_a_pdf_as_file(NavigationTest) [/Users/yves/Developpement/Projects/CRAFTING/pdf_renderer/test/integration/navigation_test.rb:15]:
Expected /Prawn/ to match “”.

2 tests, 6 assertions, 1 failures, 0 errors, 0 skips

Test run options: —seed 63768
rake aborted!

13SUGGEST

update Enginex gem ..

$ rake test

rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)

`include Capybara` is deprecated please use `include Capybara::DSL` instead.

22ERROR

Running with:

ruby 1.9.2p312 (2011-08-11 revision 32926) [x86_64-darwin10.8.0]
Rails 3.0.10
capybara (1.1.2)

rake test fails with:

encoding error : output conversion failed due to conv error, bytes 0xFF 0xC3 0xBF 0xC3
I/O error : encoder error

Change in test/integration/navigation_test.rb

From:
assert_match /Prawn/, page.body
To:
assert_match /Prawn/, page.source

rake test passes clean

Suspect capybara internals change - Gemfile could be pinned to the older version of Capybara that works as advertised (or not).

131ERROR

I cannot get why this source code appears here.

>>
Download responders/2_responders/test/dummy/app/views/layouts/application.html.erb

<%= notice %>

<%= alert %></
<<

46ERROR

at least with rails 3.2.9
assert_equal ActionView::Template::Handlers::ERB, template.handler
has to be changed to
assert_kind_of ActionView::Template::Handlers::ERB, template.handler
for getting the tests to pass later on

47ERROR

at least with rails 3.2.9 the sql_template.rb needs the line

attr_accessible :body, :format, :handler, :locale, :partial, :path
for the tests to pass.

51TYPO

“As you learned in the code on page 59,…” should be “As you learned in the code on page 44,…”.

91ERROR

the test suite isn’t green as promised. i get the following error:
E:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.0.3/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `rescue in log’: ArgumentError: wrong number of arguments(1 for 0): SELECT name (ActiveRecord::StatementInvalid)
FROM sqlite_master
WHERE type = ‘table’ AND NOT name = ‘sqlite_sequence’
.
.
.

213ERROR

(Location 213 of 4082 in Kindle): First “rake test” bombs with this error:
rake aborted!
GONE
/Users/cclogicimac/rails_projects/crafting_rails/pdf_renderer/Rakefile:10:in `require’
/Users/cclogicimac/rails_projects/crafting_rails/pdf_renderer/Rakefile:10:in `<top (required)>’
(See full trace by running task with —trace)

if you run it with —trace the additional lines are:
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load_rakefile’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:581:in `raw_load_rakefile’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:87:in `block in load_rakefile’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:86:in `load_rakefile’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:70:in `block in run’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/lib/rake/application.rb:68:in `run’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.2/bin/rake:37:in `<top (required)>’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `load’
/Users/cclogicimac/.rvm/gems/ruby-1.9.3-p194/bin/rake:23:in `

213ERROR

(213 of 4082 on Kindle) NOTE! You can get around this error by opening the Rakefile and changing line 10 to be require ‘rdoc/task’ (instead of rquire ‘rake/rdoctask’)

11SUGGEST

The suggestion in the online Errata to remove render_to_string does cause the test to pass, but it does not render a .pdf file as it should.

The problem is that we did not create an index.html.erb file as a template. The book says we should.

In other words, there should be no erratum for this issue.

Categories: