Errata

Head First Rails

Errata for Head First Rails

Submit your own errata for this product.

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.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page ?
Example code, Chapter 1

Originally submitted in Head First Rails book forum:
http://forums.oreilly.com/content/Head-First-Rails/3803/Rails-Version-Matters/#entry10675

Changes in html.erb files and database weren't visible in Rails version 2.3.2. I finally found that if I installed rails gem version 2.1.2, which is what the downloaded code uses, my code works.

Maybe you should check this out and either figure out how to make the code work with rails v 2.3.2, or warn people in your Read Me preface not to go with 2.3.2.

Note from the Author or Editor:
I have emailed Brett Mclaughlin to see how best to handle it

Anonymous  Mar 24, 2009 
4-5
answer to list items 2 and 3

Answers to questions 2 & 3 are reversed

Note from the Author or Editor:
Pool puzzle answers 2 and 3 on page 6 need to be switched.

Ron Bingham  Feb 09, 2009 
4
Number (1) of the points

Is "to" here extra that has to be removed?

We need a set of pre-written code "to" that will form the foundation of
the web application.

Abder-Rahman  Jun 16, 2010 
4
Last paragraph

you will probably still need these "three" things for your deployed application.

Isn't it supposed to be "four" things? Since we have four points?

Thanks.

Abder-Rahman  Jun 16, 2010 
4
Under "An Application Framework"

In the following:

We need a set of pre-written code "to" that will form the foundation of
the web application.

I think that "to" has to be removed.

Thanks.

Abder-Rahman  Jul 14, 2010 
5
First line under Pool Puzzle

There are many features built "in to" Rails.

Shouldn't it be "into"?

Thanks.

Abder-Rahman  Jun 16, 2010 
6
Pool Puzzle Solution

There are many features built "in to" Rails.

Shouldn't it be "into"?

Thanks.

Abder-Rahman  Jun 16, 2010 
6
Pool Puzzle Solution

I think the solutions don't match the points?

For example SQLite3 RDBMS is set to web server. Shouldn't it be to the database system point, which is (2)?

Thanks.

Note from the Author or Editor:
Swap the positions of "Bundled HTTP server" and "SQLite3 RDBMS"

Abder-Rahman  Jun 16, 2010 
6
1st paragraph

The main reason "these application exists".....

Shouldn't it be "these applications exist"?

Thanks.

Abder-Rahman  Jun 16, 2010 
8
Under Geek Bits

"It" you want to use another port, such as 8000, run...

I think it should be "If".

Thanks.

Abder-Rahman  Jun 16, 2010 
16
Last paragraph

Scaffolding generated a whole set of pages that allow us to create, modify, and delete ticket details.

Shouldn't we have "read" also here?

Thanks.

Note from the Author or Editor:
Change "create, modify, and delete" to "create, read, modify, and create".

Abder-Rahman  Jun 17, 2010 
20
3rd paragraph

"separated according to it's function"

should be "its"

Kathy Jacobson  Mar 18, 2009 
21
Point (1)

The model code manages how "data is written and read to your database".

Shouldn't it be:

data is written to and read from your database?

Thanks.

Abder-Rahman  Jun 17, 2010 
26
The title: The files in the VIEW need to be edited

The files in the "VIEW" need to be edited

Shouldn't the "VIEW" be "VIEWS" since it refers to the name of the folder?

Thanks.

Abder-Rahman  Jun 17, 2010 
30
Inside the man's talking bubble

'suposed' should be changed to 'supposed'

Note from the Author or Editor:
"bookings are suposed" in the boss' speech bubble should be replaced with "bookings are supposed"

Brett Goulder  Jan 06, 2009 
34
Last paragraoh (Note)

AddPhoneToTickets adds phone to the "ticket" table.

I think it should be "tickets"?

Thanks.

Abder-Rahman  Jun 17, 2010 
Printed
Page 36
Block with code added to show.html.erb

Bold code shows email_address; should be phone.

Note from the Author or Editor:
The code highlights the wrong piece of code and does not display the code that was added. Instead of showing this:
<p>
<b>Price paid:</b>
<%=h @ticket.price_paid %>
</p>

<p>
<b>Email address:</b>
<%=h @ticket.email_address %>
</p>

<p>


It ought to show this:

<p>
<b>Email address:</b>
<%=h @ticket.email_address %>
</p>

<p>
<b>Phone:</b>
<%=h @ticket.phone %>
</p>


The paragraph with the phone information ought to be emboldened.

sean kearney  Jan 07, 2009 
Printed
Page 36
1st paragraph

An 'is' is missing after 'it': "once the code has been generated it the developer's ..."

Gabriele Bartolini  Feb 19, 2009 
36
First paragraph

But the downside is that once the code has been generated it the developer's responsibility to keep the code up-to-date.

It should be: ".... it 'is' the developer's responsibility..."

Thanks.

Note from the Author or Editor:
Change "it" to "it's"

Abder-Rahman  Jun 17, 2010 
46
The note beside price

Since all the notes contain a "." after them. Do you think "A decimal" has to have a "." (dot) at the end for consistency?

Thanks.

Abder-Rahman  Jun 17, 2010 
Printed
Page 51
DB Table 'ads' on right side of page

There is an arrow with text "This is the generated primary key." which points to somewhere where it could be misunderstood. It should refer to only the 'id'-row. It could also be read and understood that it refers to all three rows ('id', 'created_at' and 'updated_at') which are surrounded.
Greetings from Freiburg in lovely Germany

Note from the Author or Editor:
The penciled loop associated with the annotation should only include the id field.

Mike Just  Jan 26, 2009 
Printed
Page 54
2nd paragraph: text

Text: ..."If someone asks for for ad#3..."
Double word "for for", change to "for".

Greetings from Freiburg in lovely Germany

Mike Just  Jan 26, 2009 
54
2nd paragraoh

If someone asks for "for" ad.....

"for" is repeated twice.

Thanks.

Abder-Rahman  Jun 17, 2010 
Printed
Page 60
10th question

The 10th question is in singular form, although it should be in plural.

Question in the book is: Why are the templates in a folder called "views/ad" but the controllers are not in "controllers/ad?

The correct version is: Why are the templates in a folder called "views/ads" but the controllers are not in "controllers/ads?

Note from the Author or Editor:
"views/ad" should be changed to "views/ads" and "controllers/ad" should be changed to "controllers/ads"

Anonymous  Jan 31, 2009 
60
First answer

MeBay only "want" a very small amount of.....

Shouldn't it be "wants"?

Thanks.

Abder-Rahman  Jun 17, 2010 
61
3rd line of code

missing single quote at end of line:
'show
should be 'show'

Kathy Jacobson  Mar 23, 2009 
Printed
Page 61
Diagram on the right showing contents of the view directory

The page templates shown in the diagram all end with *.html.rb extension. Shouldn't they be *.html.erb since they will be processed by ERb?

Note from the Author or Editor:
The .html.rb extensions on that page should be html.erb

Winston Tsai  Sep 08, 2009 
Printed
Page 70
'Congratulations!' paragraph

"What's more, you taken a peek..." should be
"What's more, you've taken a peek..."

Note from the Author or Editor:
"you taken a peek" should be "you've taken a peek"

K. Oster  Jan 31, 2009 
70
Under "Congratulations"

...."you" taken a peek under the hood of Rails....

Shouldn't be there a "have" after you?

Thanks.

Abder-Rahman  Jun 17, 2010 
Printed
Page 72
note for 'params[:id]' in 'Pool Puzzle Solution'

"...user is asking for /ads/3, ..." should be
"...user is asking for /seller/3, ..."

Note from the Author or Editor:
In the intro paragraph on pages 71/72, "/seller/:id" should be "/sellers/:id"

In the annotation on page 72 "/ads/3" should be "/sellers/3"

K.Oster  Jan 31, 2009 
Printed
Page 73
note for 'All Ads' webpage screen shot

'An index pag.' should be 'An index page'

Note from the Author or Editor:
Annotation on the "All Ads" page should be "An index page."

K.Oster  Jan 31, 2009 
73
The note to the "All Ads" window

I think it should be "page".

An index "pag".

Thanks.

Abder-Rahman  Jun 21, 2010 
74
First question - Second colum

should the following sentence be "Ruby on Rails". (on) INSTEAD OF (or)?

Ruby or Rails

Thanks.

Abder-Rahman  Jun 21, 2010 
Printed
Page 75
Routing example

One forward slash missing from the routing example if we want to stay consistent. Second line should read /ads/ instead of ads/

The code in the book is as follows:
map.connect '/ads/:id', :controller => 'ads', :action => 'show'
map.connect 'ads/', :controller => 'ads', :action => 'index'

It should be:
map.connect '/ads/:id', :controller => 'ads', :action => 'show'
map.connect '/ads/', :controller => 'ads', :action => 'index'

Note from the Author or Editor:
The line of code beginning:

map.connect "ads/"...

should be

map.connect "/ads/"...

Anonymous  Jan 31, 2009 
82
answer #2

It doesn't keep it's own

should be
It doesn't keep its own

Kathy Jacobson  Mar 23, 2009 
82
First question - Second column

Should it be "its", instead of "it's"

...It doesn't keep "it's" own copy of an object, it just remembers
where they live.

Thanks.

Abder-Rahman  Jun 21, 2010 
85
first line

'form_for' helper

We are actually using the 'remote_form_for' in both _edit.html.erb and _new.html.erb

Kathy Jacobson  Apr 28, 2009 
Printed
Page 89
first block of code: line 2

(Beyond Scaffolding)
Loops can be added to page
templates using scriplets

The block of code a the top pointed to by the long arrow:

for ad in @ads
print '<li><a href="'
print ad.id
print '">'
print ad.name
print '</a></li>'
end

should read: ( added to line 2: /ads/ )

for ad in @ads
print '<li><a href="/ads/'
print ad.id
print '">'
print ad.name
print '</a></li>'
end

hing hoo bird  Apr 09, 2009 
Printed
Page 93
Lower 3rd

Download this!
Instructions are to download style sheet, but no style sheet is given at web address. I checked the public directory for chapter2 and it is not in the zipped file either.

Note from the Author or Editor:
A copy of the file public/stylesheets/default.css needs to be taken out of http://www.headfirstlabs.com/books/hfrails/code/chap2_hfrails_code_20081127.zip and given a separate link on http://www.headfirstlabs.com/books/hfrails/ just as development.sqlite3 currently is.

It will obviously also need to remain in the zip file.

Anonymous  Aug 06, 2009 
Printed
Page 95
screenshot

I downloades and uses the layouts/ads.html.erb as explained in chapter 2. However when I later created the form on page 112 it breaks the layout, so that the content runs down into the footer. This despite of the thet fact that <%= yield %> is in <div id="content">?

Why is this?

Thanks

Note from the Author or Editor:
It's a stylesheet issue. Doesn't handle browser resize very well.

Anonymous  Apr 13, 2009 
96
Sharpern your pencil (Solution)

I think "the" has to be "a".

Is there "the" problem with inserting...

Thanks.

Abder-Rahman  Jun 23, 2010 
97
3rd paragraph

Shouldn't it be "puts". With an (s)?

..., Rails already "put" quite a few

Thanks.

Abder-Rahman  Jun 21, 2010 
Printed
Page 111,112
1st paragraph

The <% form for %> tag is missing an underscore.
It should be <% form_for %>

Winston Tsai  Sep 15, 2009 
Printed
Page 114
Note for '@ad = nil'

'...no other attributes avaialble, ..." should be
'...no other attributes available, ..."

Note from the Author or Editor:
"Available" is mis-spelled in the top annotation.

K.Oster  Feb 02, 2009 
Printed
Page 114
diagram


Okay so you state - hey before you reference @ad you have to create in the controller. Excellent. Did it. Have the view for new.html.erb. But no form. Just the words "New ad".

tried moving you app folder over mine. Same result. No form.
2 hours later. Looked at rails documentation
http://api.rubyonrails.org/
at Module
ActionView::Helpers::FormHelper

Whoa - none of the example say the way you are calling is valid.
Changed your code:
<% form_for(@ad,:url=>{:action=>'create'}) do |f| %>

to

<% form_for :ad,:url=>{:action=>'create'} do |f| %>

Bam!! It works - sooooooo.

or you could also change it to:

<% form_for(:ad, @ad,:url=>{:action=>'create'}) do |f| %>

Otherwise thank you for a wonderful book. Wow what a way to learn. you guys rock!!!

Note from the Author or Editor:
Replace "@ad" in the second line of the HTML on page 114 with ":ad"

farida memon  Feb 28, 2009 
Printed
Page 115
(3) in the diagram

"new html.erb" should be "new.html.erb"

Akira Matsuda  Oct 13, 2009 
120
3rd paragraph

Shouldn't the seconf "of" be removed?

...with a set of hash table "of" values that will be...

Thanks.

Note from the Author or Editor:
Change:

set of hash table of

to:

hash table of

Abder-Rahman  Jun 24, 2010 
131
First question in the third column

Shouldn't "That" be "That's"?

"That" way, if someone enters a record,.....

Thanks.

Abder-Rahman Ali  Jun 27, 2010 
Printed
Page 140
Test Drive screenshots

The second and fourth screen shots should be switched.

The 'All Ads' screenshot should forward link to the screenshot with Description of 'Suit person with left foot'

The 'Editing Leather boot' screenshot should forward link to the screenshot with Description of 'High quality kid-leather...'

Note from the Author or Editor:
The screenshots with "/ads/40" at the ends of the URLs need to be switched.

K.Oster  Feb 02, 2009 
Printed
Page 143
line 1 of code box

The class should read"AdsController" and not "AdController"

Raymond Jenkins  Apr 03, 2009 
160
next to last paragraph

"requires needs a model object to work."

choose one of "requires needs"

Note from the Author or Editor:
Change to "needs"

Kathy Jacobson  Mar 26, 2009 
Printed
Page 161
bottom

One of the fridge magnets has a typo. The magnet "search_string" should be :search_string

Note from the Author or Editor:
The magnet containing:

"search_string"

should contain

:search_string

Anonymous  Jan 31, 2009 
Printed
Page 161
magnets

The magnets offer the choice of "search_string", but in the solution on the next page, the answer is :search_string.

Anonymous  Jun 06, 2009 
Printed
Page 164
Under "Ready Bake Code

The URL to download the "ready bake code" ends in books/rails. The correct URL ends in books/hfrails.

Anonymous  Jun 06, 2009 
Printed
Page 166
3rd paragraph

The paragraph starts with: WIth a model form ...

The second letter is capital, should be corrected to: With a model form ...

Note from the Author or Editor:
"WIth" should be "With"

Anonymous  Jan 31, 2009 
Printed
Page 166
page title

params is not an Array but a Hash.

Page title "use the params array" should be
"use the params hash"

Note from the Author or Editor:
Replace "use the params array" with "use the params" (don't use either the word "hash" or "array") because params is neither.

Akira Matsuda  Oct 18, 2009 
Printed
Page 169
Last paragraph

'...the string the user is searching form.' should be
'...the string the user is searching for.'

Note from the Author or Editor:
"is searching form" should read "is searching for"

K.Oster  Feb 02, 2009 
Printed
Page 170
Answer to first question of 'there are no Dumb Questions'

'...no object to with a single...' should be
'...no object with a single...'

Note from the Author or Editor:
'...no object to with a single...' should be
'...no object with a single...'

K.Oster  Feb 02, 2009 
173
2nd paragraph

"finder for each of it's attributes"

it should be "its"

kajaco2  Mar 26, 2009 
Printed
Page 181
Second note for parameterized code statement

'...and avoid a type security attack...' should be
'...and avoid a type of security attack...'

Note from the Author or Editor:
"type security" should be "type of security" in the final annotation.

K.Oster  Feb 03, 2009 
Printed
Page 190
Screenshot under 'Editing bad data'

If the user is on the edit form page, shouldn't the button show 'Update' instead of 'Create'?

Note from the Author or Editor:
Needs an updated screenshot for the edit screen. You will need to contact me.

K.Oster  Feb 03, 2009 
Printed
Page 196
First paragraph

'Some people are have been leaving...' should be
'Some people have been leaving...'

Note from the Author or Editor:
"Some people are have" should be "Some people have"

K.Oster  Feb 03, 2009 
196
2nd paragraph

"trainer's name need to completed"

should be "need to be completed"

Note from the Author or Editor:
Should be:

"Trainer's name needs to be completed"

kajaco2  Mar 27, 2009 
Printed
Page 203
Last paragraph

'...on new adds were completed,...' should be
'...on new ads were completed,...'

Note from the Author or Editor:
"adds were" should be "ads were"

K.Oster  Feb 05, 2009 
Printed
Page 211
1st paragraph

"Now what happens now if we miss..."

Skip ONE of these two "now", so
either "Now what happens if we miss..."
or "What happens now if we miss..."
sounds right to me.

Note from the Author or Editor:
Change to:

What happens now if we miss

Mike Just  Jun 30, 2010 
Printed
Page 220
Section heading

'Coconut Airways need a booking system' should be
'Coconut Airways needs a booking system'

Note from the Author or Editor:
'Coconut Airways need a booking system' should be
'Coconut Airways needs a booking system'

K.Oster  Feb 05, 2009 
Printed
Page 230
1st paragraph

In the 2nd sentence "Here's the content of our _new_seat.html.erb partial." only the partial file name should be printed in the fixed width font face. So the word "our" in this sentence has been printed in the wrong font face.

Mike Just  Jul 01, 2010 
Printed
Page 231
Sentence under show.html.erb flight page

'The render call tell Embedded Ruby...' should be
'The render call tells Embedded Ruby...'

Note from the Author or Editor:
'The render call tell Embedded Ruby...' should be
'The render call tells Embedded Ruby...'

K.Oster  Feb 05, 2009 
231
Last paragraph

The render call "tell" Embedded Ruby to process the partial and include its output at that point in the file.

I think "tell" has to be "tells" (With an (s) at the end).

Thanks.

Abder-Rahman  Jul 15, 2010 
Printed
Page 242
3rd paragraph

The word 'new' ("...to provide the new _seat_list.html.erb partial...") has the wrong font; it should have the same font as the preceding word, 'the'.

Note from the Author or Editor:
"provide the new" should all be in the Body style.

K.Oster  Feb 05, 2009 
242
Code box, last note

"Remove the list to"

should be "Remove the link to"

kajaco2  Apr 01, 2009 
Printed
Page 242
1st paragraph

New partial is given name _seat_list.html; thereafter it is referred to as _seat_list.html.erb

Anonymous  Jun 11, 2009 
Printed
Page 242
1st paragraph

Paragraph ends with "Let's call this new partial _seat_list.html:"
should read "Let's call this new partial _seat_list.html.erb:"

paul mak  Mar 28, 2010 
Printed
Page 246
last sentence

Seat.find_all_for_flight_id(...)

should be:

Seat.find_all_by_flight_id(...)

Ivo Balbaert  Feb 15, 2009 
Printed
Page 247
directory tree in the right side

app
views
flight.rb
should be
app
models
flight.rb

Akira Matsuda  Aug 02, 2009 
Printed
Page 254
last figure right

The figure should read: app models seat.rb

instead of: app views seat.rb

Ivo Balbaert  Feb 15, 2009 
Printed
Page 256
Q+A

Q: How do I call a partial form a layout?
A: Using a render method, just like you would from a partial.
I believe this should read:
A: Using a render method, just like you would from a template.

paul makk  Mar 28, 2010 
Printed
Page 265
first paragraph, line 4

The file ending .erb should be formatted the same way as the rest of the file name: app/views/flights/show.html..

Note from the Author or Editor:
Change the font of the "erb" at the start of the line so that it is in code style.

jhs06r  Oct 20, 2009 
269
2nd paragraph

Last line ends in "return it to the browser."

This should be, "returns it to the browser."
(The controller looks...generates...and returns...)

kajaco2  Apr 06, 2009 
269
diag showing "Listing seats" and diag showing HTML code

The heading for "Flight" should be deleted, i.e., instead of "Flight Name Baggage", it should be "Name Baggage". This can be achieved by deleting the line in the HTML code:
<th>Flight</th>
from the file _seat_list.html.erb (under /app/views/flights).
Actually this (deletion) should have been done on pg.242 in Ch. 6.

Winston  Sep 20, 2009 
Printed
Page 269
"screenshot"

The text, html source fragment and top of the screenshot refer to flight 2, but the seat list shown is for flight 1

Allan Kinnaird  Nov 07, 2009 
Printed
Page 273
2nd paragraph

In "We can get around this is by giving..." remove the "is".

Mike Just  Jul 13, 2010 
275
6th answer (top of right column)

"The presence of the value in a request show that a request..."

'show' should be 'shows':
"The presence of the value in a request shows that a request..."

kajaco2  Apr 06, 2009 
Printed
Page 275
Answer to the questions[-2]

The answer says the javascript_include_tag helper "adds a random number", but that's not true.
The helper actually adds the target file's mtime.to_i value.

Note from the Author or Editor:
Change "random number" to "long number"

Akira Matsuda  Aug 21, 2009 
Printed
Page 275
Answer to the questions.last

The answer describes as though a new copy of the asset file will everytime be downloaded as the users request the page, but it's untrue.
A new copy of the file will be downloaded only when the file was updated or the browser missed the cache.

Note from the Author or Editor:
Change the last answer to:

"It means that if anything changes in your JavaScript library, the user will always get the latest version."

Akira Matsuda  Aug 21, 2009 
Printed
Page 287
2nd paragraph

"But how do we make this the..." should be
"But how do we make this..." or
"But how do we make the..."

Note from the Author or Editor:
s/be "But how do we make the form work..."

Akira Matsuda  Aug 24, 2009 
Printed
Page 298
1st paragraph

"you might expect that you will need to how to write JavaScript code" should be
"you might expect that you will need to know how to write JavaScript code"

Akira Matsuda  Aug 24, 2009 
Printed
Page 299-300
First paragraph (both pages) and code magnets on page 299

"...the HTML in the 'notices' <div/>..." should be
"...the HTML in the 'notice' <div/>..."

The 'notices' code magnet should be a 'notice' code magnet on page 299.

Note from the Author or Editor:
On page 299 change the instructions on the Code magnets from:

...HTML in the 'notices'...

to

...HTML in the 'notice'...

Change the 'notices' magnet to 'notice'

K.Oster  Feb 09, 2009 
302
Near the top

It would be helpful to say which file this is from. I've assumed _new_seat.html.erb, since we are creating a new seat.

Note from the Author or Editor:
Add an annotation to the code and label it:

_new_seat.html.erb

kajaco2  Apr 07, 2009 
Printed
Page 304
the last paragraph

"the page object will generate code to updates the notice" should be
"the page object will generate code to update the notice"

Akira Matsuda  Aug 24, 2009 
Printed
Page 304
Heading

The heading says "The completed code CAN WILL now do several things"
It should be:
"The completed code can now do several things"

jhs06r  Oct 20, 2009 
Printed
Page 318
Last paragraph

'...we used Ajax to download new version...' should be
'...we used Ajax to download a new version...'

K.Oster  Feb 09, 2009 
Printed
Page 332

in the code: :root => "name" should read: :root => "data"

Ivo Balbaert  Feb 15, 2009 
Printed
Page 335
4th A[nswer], 4th line

"and you will found several places" should read
"and you will find several places"

Steve Hoogheem  Apr 01, 2009 
Printed
Page 349
2nd to last sentence

'...and the XML bulder template...' should be
'...and the XML builder template...'

K.Oster  Feb 09, 2009 
351-2
1st paragraph (instructions)

"you won't need to use all the snippets"

Not true: all 10 items are used.

Note from the Author or Editor:
Add another "end" snippet on both page 351 and 352.

Kathy Jacobson  Apr 24, 2009 
Printed
Page 359
1st paragraph, 3rd line

In the 1st paragraph, 3rd line, the word "the" is doubled.
Instead of "could probably just remove the the list of incidents..."
write "could probably just remove the list of incidents..."

Mike Just  Jul 19, 2010 
Printed
Page 360
1st paragraph

"The people ... figured that ..."
In school we learned it should be: "The people ... figured OUT that ..."
Please let me know when I am wrong via email instead of silent deleting this submission.

Mike Just  Jul 19, 2010 
362
3rd paragraph

"...our action will need to generated from a partial..."

should be "...need to be generated..."

Kathy Jacobson  Apr 27, 2009 
Printed
Page 369
First paragraph

"Once you've clicked on the save button, you're to the cut down..."

should read:

"Once you've clicked on the save button, you're redirected to the cut down..."

David "Sweet" Robinson  Sep 30, 2009 
Printed
Page 371
bottom

Why is params using strings here, params['latitude'] and param['longitude'], instead of symbols, params[:latitude] and params [:longitude]?

There are many examples of params[:id], including back on pages 362 & 364. And there's params[:seat] on p. 289.

Note from the Author or Editor:
Contacted the learner direct.

Steve Hoogheem  Apr 01, 2009 
Printed
Page 372
Last paragraph

Instead of 'When the map calls the "new" action is sends...'
write (the same as on page 371) 'When the map calls the "new" action it sends...'

Mike Just  Jul 19, 2010 
Printed
Page 373
1st para

On this page, the scenario described is that the form remains displayed on the same screen after "create" is submitted. However, this is not what happens - the user is actually sent to another screen via `redirect_to(@incident)`.


This is borne out on pg 337, depicting existing code:

format.html { redirect_to(@incident) }


Full method:

def create
@incident = Incident.new(params[:incident])

respond_to do |format|
if @incident.save
flash[:notice] = 'Incident was successfully created.'
format.html { redirect_to(@incident) }
format.xml { render :xml => @incident, :status => :created, :location => @incident }
else
format.html { render :action => "new" }
format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }
end
end
end


Also worth noting, since we're no longer redisplaying the "new.html.erb" form, there is no <%= f.errors %> tag to display the flash message to, so the "flash" code has no visible effect.

HTH,
Cosmo

Note from the Author or Editor:
2ns screenshot is wrong. It should show a read-only view of the data, rather than the form.

Cosmo Lee  Apr 20, 2009 
377
top left corner

The file tree containing the _new.html.erb file is missing the incidents directory. It should have this structure:
app/views/incidents/_new.html.erb

Kathy Jacobson  Apr 28, 2009 
380
Answer #2

"...calls all of it's own..."

should be "...its..."

Kathy Jacobson  Apr 28, 2009 
385
Answer #1

"That return true..."

should be "That returns true..."

Kathy Jacobson  Apr 28, 2009 
Printed
Page 385
Q+A

Last question reads:

"But we don't have fields for id, created_ad and updated_at fields?"

this should read:

"But we don't have fields for id, created_ad and updated_at?"

paul mak  Apr 05, 2010 
Printed
Page 389
Bottom of page

When updating this code using a route helper:
<p><%= link_to "Edit", "/incidents/#{incident.id}/edit" %></p>

Shouldn't the updated code use edit_incident_path instead of edit_incident_url?

Note from the Author or Editor:
edit_incident_url should be replaced with edit_incident_path

K.Oster  Feb 11, 2009 
Printed
Page 391
2 code examples near bottom

I assume the correction on p. 389 replacing "edit_incident_url" with "edit_incident_path" carries forward to this page too, in both code examples near the bottom of the page.

Steve Hoogheem  Apr 01, 2009 
396
last paragraph

"Well that works pretty like the new form did."

pretty much?

Kathy Jacobson  Apr 28, 2009 
Printed
Page 397
Answer to first question

'...harder to reader and...' should be
'...harder to read and...'

K.Oster  Feb 11, 2009 
Printed
Page 397
5th A[nswer] & 7th A[nswer]

Are PUT and POST swapped on this page?

Looking the "rake routes" output on p. 388 (and repeated on pp. 393 & 394):
1. an http POST (in both rows) causes a create action.
2. an http PUT (in both rows) causes an update action.

5th A[nswer]:
"PUT is used for requests that will create new records ..."
should be
"PUT is used for requests that will update records ..." ?

7th A[nswer]:
"If the object has already been saved, then form_for generates a form that will use the POST action. If the object is new, then it will generate a form that uses PUT."
should be
"If the object has already been saved, then form_for generates a form that will use the PUT action. If the object is new, then it will generate a form that uses POST." ?

Note from the Author or Editor:
7th answer on p. 397 - swap "POST" and "PUT"

Steve Hoogheem  Apr 01, 2009 
Printed
Page 398
bottom

"Visti us here for details..." should be "Visit..." (?)

Akira Matsuda  Sep 28, 2009 
Printed
Page 401
1st paragraph

How do you make the most out **the** Rails and the Ruby language?

Note from the Author or Editor:
Change text to be:

How do you make the most out of Rails and the Ruby language?

Anonymous  May 31, 2009 
Printed
Page 405
the last one in the left column

"Pretty-print the contents of an array"
should be "Pretty-print the contents of a hash"

Akira Matsuda  Sep 23, 2009 
Printed
Page 405
right side

"alias my_method" will cause syntax error.
It should be
"alias another_name my_method"
or sth.

Akira Matsuda  Sep 23, 2009 
Printed
Page 408
2nd paragraph

"That why" should be "That's why"

Akira Matsuda  Sep 26, 2009 
Printed
Page 409
middle

development:
adapter: oracle

should read:
production:
adapter: oracle

Ivo Balbaert  Feb 15, 2009 
Printed
Page 409
first example

development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000

should be

production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 5000

Akira Matsuda  Sep 26, 2009 
Printed
Page 409
2nd example

This Oracle example won't work.
You should specify database: parameter whenever you use oracle driver (instead, host: is optional).

Note from the Author or Editor:
In the Oracle config change:

host: mydatabaseserver

to:

database: mydatabasename

Akira Matsuda  Sep 28, 2009 
411
Caption for illustration at bottom of page

"These are the used in the RESTful routes in a scaffold application."

should be "These are the urls..."

Kathy Jacobson  May 01, 2009 
Printed
Page 411
last section

"The third principle... there should __ a well defined..."

Missing "be" a well defined...

Anonymous  May 31, 2009 
Printed
Page 412
2nd para, 3rd para

2nd para:
Rails make*S* it really..

3rd para:
Play with paths [period]

6th para:
...latest version of the rails scripts... cap. Rails

Anonymous  May 31, 2009 
Printed
Page 412
6th paragraph

rake rails:freeze:edge
installs Edge Rails into vendor/rails directory. Not vendor/plugins

Akira Matsuda  Sep 28, 2009