We try to keep our books accurate, but sometimes mistakes creep
in. This page lists the errors submitted by our astute readers.
If you've found a new error, please
submit it.
The latest version of the book is P6.0,
released almost 7 years ago.
If you've bought a PDF of the book and would like to upgrade
it to this version (for free), visit your
home page.
| PDF |
Paper |
Description |
Found in |
Fixed in |
| hpcXE |
tYVhL |
#47654: iLhIjY web20power.txt;1;1--JiueKXnZGiTq
|
P6.0
28-Sep-11
|
|
| i |
i |
#23216: Dave says: For general help with Rails and examples in the book, I recommend the Rails mailing list at http://lists.rubyonrails.org/mailman/listinfo/rails
We need a forum for problems encountered while working through examples and better descriptions of how to fix the Mac Tiger mysql problems--Richard Williams #23216: Dave says: For general help with Rails and examples in the book, I recommend the Rails mailing list at http://lists.rubyonrails.org/mailman/li ...more...
|
P2.0
25-Aug-05
|
|
|
1 |
#24344: You should put together a comprehensive list of all the naming conventions in one place. "id" is in the begining of the book, datetime on page 116 and the sloppy wrapup on page 188 just doesn't cut it.--Old C Hippie #24344: You should put together a comprehensive list of all the naming conventions in one place. "id" is in the begining of the book, datetime on pag ...more...
|
P4.0
21-Mar-06
|
|
| 2rand |
2rand |
#47533: +z$8frZdyL%68pSU/:>w<:E3.lG-!XIB--zyqMdVsbiEOwzNQ
|
P6.0
10-Sep-11
|
|
| 5 |
|
#24234: Currently, all downloadable code linked from the PDF book has the Content-Type set to "text/html". This will make most browsers show the code in one huge line without breaks.
It would be nice if all downloadable code had the Content-Type set to "text/plain", so browsers show them nicely formatted.
In a perfect world, you would be able to set the Content-Type to "text/x-ruby-source" or something like that, and the browser would show the code with syntax highlight... oh, well...--Marcus Brito #24234: Currently, all downloadable code linked from the PDF book has the Content-Type set to "text/html". This will make most browsers show the code ...more...
|
P4.0
03-Mar-06
|
|
| 5 |
|
#24514: "In the margin, you--jeff e
|
P4.0
21-Apr-06
|
|
| 6 |
|
#24088: "This book documents Rails V1.0, which became available in mid 2005" should be "This book documents Rails 1.0, which became available on December 13, 2005"
Also "the last release before Rails 1.0" should be "one of the last releases before Rails 1.0"--Peter T Bosse II #24088: "This book documents Rails V1.0, which became available in mid 2005" should be "This book documents Rails 1.0, which became available on Decem ...more...
|
P4.0
08-Feb-06
|
|
| 15 |
|
#24522: "Sometimes these class-level methods return collections of objects.
Order.find(:all, :conditions => "name='dave'") do |order|
puts order.amount
end"
Find returns a collection but requires an iterator to call the block on it. So I think you're missing an ".each" before the "do".--Kieron Browne #24522: "Sometimes these class-level methods return collections of objects.
Order.find(:all, :conditions => "name='dave'") do |order|
puts order.a ...more...
|
P4.0
23-Apr-06
|
|
| 20 |
|
#25308: Well one drop for the general context... I must confess I haven't bought that book yet, I'm just testing it.
It's my first contact with Rails, Ruby and even MySQL (began yesterday)
Your explanation for the installation on windows is nice, but too "simple". In fact since there isn't another way to install Rails without dowloading it thru gem, you need to care about people who are "behind" a firewall with NAT. I suspected I needed to tell to "gem" that I was using a proxy ..but where and how !!!. I checked in many files in the gem directories but without succes. Also unlucky on official Rails homepage. A few haurs later I fanally found the info in a fack in the wiki version for Rail.
Please specify the following parameter for people using proxies :
-p http://proxy:port (where proxy is the name or IP of the proxy server and port the port number used for internet access especially when "NATed")
=> ex :
gem install rails --include-dependencies -p http://192.252.1.2:8080
Sorry for my bad english, 'cause I'm a poor frenchy :)
Can feedback me on kagejin0@yahoo.fr
other Erratums will follow--Koguma #25308: Well one drop for the general context... I must confess I haven't bought that book yet, I'm just testing it.
It's my first contact with Rails ...more...
|
P4.0
21-Jun-06
|
|
|
23 |
#25285: In the fifth printing of the book, the link to Lucas Carlson's instructions for Ruby on Mac OS X Tiger leads to an error page.--Jeffrey Yu
|
P4.0
17-Jun-06
|
|
| 33 |
|
#24403: The "Making Development Easier" box is very valuable information, but I question whether this is the best place to put it. I would have rather read something about how close .rhtml is to a JSP. In any case, talking about Webrick and its use in production at this point sort of threw me off track a bit. Just a suggestion that something else might be more effective here. (-:--Lindy Mayfield #24403: The "Making Development Easier" box is very valuable information, but I question whether this is the best place to put it. I would have rathe ...more...
|
P4.0
03-Apr-06
|
|
| 50 |
|
#24405: I am going through the tutorial with you: After "rails depot" and then "cd depot" and then "ls" my directories are different from yours. For example I don't have CHANGELOG or Rakefile.--Lindy #24405: I am going through the tutorial with you: After "rails depot" and then "cd depot" and then "ls" my directories are different from yours. For ...more...
|
P4.0
03-Apr-06
|
|
| 50 |
|
#24533: The code at the bottom of the page is unclear. What should one do with it? Type it at an 'mysql' prompt? If so, the result is an error (1046) that states that no database is selected. #24533: The code at the bottom of the page is unclear. What should one do with it? Type it at an 'mysql' prompt? If so, the result is an error (104 ...more...
|
P4.0
26-Apr-06
|
|
| 50 |
|
#25309: I'm using MYSQL 5.0.22 the current last stable version on windows XP SP2. It's my first enccounter with MYSQL so my problems could be related to my lack of experience.
Nevertheless in your databases creation process thru the command-line I got some trouble.
In fact the "grants" didn't work because they expect to have the users created before. For instance thru a CREATE USER 'dave'@'localhost' and CREATE USER 'prod'@'localhost' identified by 'wibble'.
The bad point is that by doing so (maybe a new default behavior of Mysql) all the priviledges are granted to these users. So we need to restrict thme by command line or by using a GUI (I advise to use MySQL-Front, it's a nice free toy)
=> same erratum on page 51 when you create the table products thru the sql script. By doing so you're using an ODBC user. So you need to create an 'ODBC'@'localhost'.
Feedbacks on kagejin0@yahoo.fr--Koguma #25309: I'm using MYSQL 5.0.22 the current last stable version on windows XP SP2. It's my first enccounter with MYSQL so my problems could be related ...more...
|
P4.0
21-Jun-06
|
|
| 51 |
|
#23994: you might want to add "-u dave" to the mysql statement--Chad Bearden
|
P4.0
26-Jan-06
|
|
| 51 |
|
#24534: When one types the following string (mysql depot_development <db/create.sql), the result is an ->. What then? This entire section is unclear.
|
P4.0
26-Apr-06
|
|
| 52 |
|
#24116: It seems that the rails script now adds the application to database.yml:
database: depot_development
It automatically replaces the rails_development with depot_development.
--John Crowhurst #24116: It seems that the rails script now adds the application to database.yml:
database: depot_development
It automatically replaces the rails ...more...
|
P4.0
12-Feb-06
|
|
| 52 |
|
#24409: Not sure if you mention this later or not, but for Windows there needs to be:
port: 3306
in the file. And for Linux there needs to be, for example:
port: 3306
socket: /var/lib/mysql/mysql.sock
--Lindy #24409: Not sure if you mention this later or not, but for Windows there needs to be:
port: 3306
in the file. And for Linux there needs to be, ...more...
|
P4.0
04-Apr-06
|
|
| 52 |
|
#25310: Depot_xxxx are already correctly set in database.yml.
But as you said after, I advise to put 'dave' as username in development and test. The system is using root by default and since no password is provided this will lead to an error in the script generation on page 53.
P.S. : I have one more parameter in the database.yml version.. host: localhost
Feedback to kagejin0@yahoo.fr--Koguma #25310: Depot_xxxx are already correctly set in database.yml.
But as you said after, I advise to put 'dave' as username in development and test. The ...more...
|
P4.0
21-Jun-06
|
|
| 53 |
|
#24500: Repeated reinstallations of entire package on OSX 10.4.6 continually produce the following:
./script/../config/../config/environment.rb:8: warning: already initialized constant RAILS_GEM_VERSION
exists app/controllers/
exists app/helpers/
exists app/views/admin
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
identical app/models/product.rb
identical test/unit/product_test.rb
identical test/fixtures/products.yml
Unknown database 'depot_development'
Error is not documented in footnotes and I can't find anything on it an forums. Any ideas? #24500: Repeated reinstallations of entire package on OSX 10.4.6 continually produce the following:
./script/../config/../config/environment.rb:8: ...more...
|
P4.0
19-Apr-06
|
|
| 53 |
|
#24510: for,
depot> ruby script/generate scaffold Product Admin
I had to use infor from http://dev.rubyonrails.org/ticket/200 to get it to work on Linux (gentoo distro).
--Mike Nelson #24510: for,
depot> ruby script/generate scaffold Product Admin
I had to use infor from http://dev.rubyonrails.org/ticket/200 to get it to work ...more...
|
P4.0
21-Apr-06
|
|
| 53 |
|
#24532: When attempting to run the line "ruby script/generate scaffold Products Admin" in Windows, I receive the following error listed in the book (addressed only for Mac): Before updating scaffolding from new DB schema, try creating a table for your model (Product). #24532: When attempting to run the line "ruby script/generate scaffold Products Admin" in Windows, I receive the following error listed in the book (a ...more...
|
P4.0
26-Apr-06
|
|
| 53 |
|
#24556: On OS X (10.4.3), when I attempt to run script/generate scaffold Product Admin, I get the following error:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
Not sure how to proceed. I have been on the IRC channels looking for help but to no avail. Any ideas? #24556: On OS X (10.4.3), when I attempt to run script/generate scaffold Product Admin, I get the following error:
You have a nil object when you d ...more...
|
P4.0
30-Apr-06
|
|
|
54 |
#24212: While creating the databases, the user should issue the command:
mysql> grant all on depot_development.* to 'dave'@'localhost';
There is no indication if the user should substitue dave with the user's own logon name. I know this is a book about Rails, but some minor SQL explanations would be nice. Could even be fine text at bottom of page!--John #24212: While creating the databases, the user should issue the command:
mysql> grant all on depot_development.* to 'dave'@'localhost';
There is n ...more...
|
P4.0
28-Feb-06
|
|
|
54 |
#24283: After setting database privileges, if you exit mysql without typing the magic words "flush privileges", the privileges you've just set won't take effect.--Daniel Torrey #24283: After setting database privileges, if you exit mysql without typing the magic words "flush privileges", the privileges you've just set won't t ...more...
|
P4.0
11-Mar-06
|
|
|
57 |
#26704: ppc:~/work/depot tomcoady$ ruby script/generate scaffold Product Admin
./script/../config/boot.rb:18:in `require': No such file to load -- rubygems (LoadError)
from ./script/../config/boot.rb:18
from script/generate:2:in `require'
from script/generate:2--Tom Coady #26704: ppc:~/work/depot tomcoady$ ruby script/generate scaffold Product Admin
./script/../config/boot.rb:18:in `require': No such file to load -- ru ...more...
|
P1.0
03-Dec-06
|
|
|
57 |
#26705: Solution to my tech error:
ppc:~/src/rubygems-0.8.11 tomcoady$ sudo ruby setup.rb
ppc:~/work/depot tomcoady$ sudo gem install -v=1.1.6 rails
--Tom Coady
|
P1.0
03-Dec-06
|
|
|
57 |
#25428: After running "ruby script/generate scaffold Product Admin" on linux box using SuSE v10.0 and MySql Ver 14.12 Distrib 5.0.22, I get an error stating /tmp/mysql.sock cannot be found. I resolved this by searching for mysql.sock and creating soft link to it from /tmp dir. e.g. ln -s /var/lib/mysql/mysql.sock tmp/mysql.sock I was then able to get form depicted on p.58--Mark Glass #25428: After running "ruby script/generate scaffold Product Admin" on linux box using SuSE v10.0 and MySql Ver 14.12 Distrib 5.0.22, I get an error s ...more...
|
P4.0
09-Jul-06
|
|
|
57 |
#23940: The 'gotcha' notes (3,4,& 5) are useful. You might consider adding another...
If you get Routing Error: Recognition failed for '/admin', make sure that you're starting WEBrick from the depot folder and not the demo folder.--Jason #23940: The 'gotcha' notes (3,4,& 5) are useful. You might consider adding another...
If you get Routing Error: Recognition failed for '/admin', ...more...
|
P3.0
12-Jan-06
|
|
|
57 |
#26760: I think the code should read
ruby script/generate scaffold Products Admin
since the table was created with the name products (plural, not singular)
otherwise when attempting to load the page, I get a recognition failed error
I made that simple change and it worked--Clark Alexander #26760: I think the code should read
ruby script/generate scaffold Products Admin
since the table was created with the name products (plural, not ...more...
|
P6.0
16-Dec-06
|
|
|
57 |
#31649: My version of the paper book is actually P5 (2006-02-16). The problem is that scaffold has changed. I am running Rails 2.02 and the following command will work.
ruby script/generate scaffold Product id:int title:varchar description:text image_url:varchar price:decimal -f
So, in answer the the question "That wasn't hard now, was it?" is actually "it was a nightmare"!!--Antony Scott #31649: My version of the paper book is actually P5 (2006-02-16). The problem is that scaffold has changed. I am running Rails 2.02 and the following ...more...
|
P4.0
11-Apr-08
|
|
|
57 |
#26821: Okay, so this is a gripe. As noted previously, the link to Lucas Carlson's fix is no longer to be found as described. However, you can go to the Internet Archive website and reconstruct the script to run locally. That being said, I have done so and have reinstalled Ruby and MySQL and am still getting the dreaded "--ray palermo #26821: Okay, so this is a gripe. As noted previously, the link to Lucas Carlson's fix is no longer to be found as described. However, you can go to t ...more...
|
P6.0
09-Jan-07
|
|
|
57 |
#24784: I've seen this error elsewhere but never a solution. Here goes: On page 57, I entered, at depot prompt,
ruby script/generate scaffold Product Admin
The error I get is:
"#28000Access denied for user 'root'@'localhost' (using password: NO)"
The author's statement after the description of this is: "That wasn't hard now, was it"...actually, it's turning out to be very hard.
I had to battle to get the commands going on page 54 too.
It really shouldn't be this hard...
--pat lynch #24784: I've seen this error elsewhere but never a solution. Here goes: On page 57, I entered, at depot prompt,
ruby script/generate scaffold Produc ...more...
|
P4.0
08-May-06
|
|
| 62 |
|
#24333: The unless clause of the validate method is wrong. To verify this, comment out 'validates_numericality_of :price' and try submitting a product without a price; you'll get a null constraint violation. Something like 'unless price && price >= 0.01' works better.--Kevin Christen #24333: The unless clause of the validate method is wrong. To verify this, comment out 'validates_numericality_of :price' and try submitting a produc ...more...
|
P4.0
19-Mar-06
|
|
| 62 |
|
#25300: In the eBook we have this code for product.rb:
errors.add(:price, "should be positive") unless price.nil? || price >= 0.01
Where as the downloadable code has the following:
errors.add(:price, "should be positive") unless price.nil? || price > 0.0
Notice that the last line compares "price > 0.0" instead of "price > 0.01"
--Max #25300: In the eBook we have this code for product.rb:
errors.add(:price, "should be positive") unless price.nil? || price >= 0.01
Where as the down ...more...
|
P4.0
21-Jun-06
|
|
| 62 |
|
#25301: Quote from second paragraph:
"Note that we only do the check if the price has
been set. Without that extra test we--Max
|
P4.0
21-Jun-06
|
|
| 62 |
|
#29155: Just a note for readers who may get put-off by the unknowability's of generated code-bases early on.
Should a user make an error in pluralisation in either the SQL or Scaffold command (e.g. product v.s. Products) the application fails with a NameError for the model name (activesupport 'load_missing_constant' in the trace) when trying to acess the 'admin' url.
I could only recover from this by deleting and recreating the whole application.
Running the Scaffold again overrode files, etc, but despite diffing between version controlled files before and after there was no visible reason why was stuck, and little info on Google addressed this.
This leaves me feeling I need to be very careful when running the Scaffold commands if you are deeper into your application development.--Liam Clancy (metafeather) #29155: Just a note for readers who may get put-off by the unknowability's of generated code-bases early on.
Should a user make an error in pluralisa ...more...
|
P6.0
28-May-07
|
|
| 63 |
63 |
#24557: Cannot "destroy" items.
Both file listings 66 & 67 omit ':post' argument in the link_to 'Destroy' line. The line should read:
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:post => true %>
--Randy W. Sims #24557: Cannot "destroy" items.
Both file listings 66 & 67 omit ':post' argument in the link_to 'Destroy' line. The line should read:
<%= link_t ...more...
|
P4.0
30-Apr-06
|
|
| 64 |
|
#24397: Link to ERb definition is not on page 31 as stated.--Pierre-Loïc Raynaud
|
P4.0
01-Apr-06
|
|
| 64 |
|
#25764: It took me quite some time when I was working through the sample code to figure out what was wrong. When editing the list.rhtml, I just erased what was there and worked through the example in the book, however, when I did that, I could never destroy any of the products that I had added. Look at the code generated from the scaffold, I realized that the example in the book is missing something vital. In File 67 the Destroy code should be replaced with this:
<td><%= link_to 'Destroy', { :action => 'destroy', :id => product }, :confirm => 'Are you sure?', :post =>true %></td>
and in File 68 it should be:
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:post => true %>
The line :post => true is missing in both files. Anyways, hope this helps.--David Kartik #25764: It took me quite some time when I was working through the sample code to figure out what was wrong. When editing the list.rhtml, I just erase ...more...
|
P6.0
21-Aug-06
|
|
| 65 |
|
#25475: ITERATION A4
|
P4.0
18-Jul-06
|
|
| 65 |
|
#24254: Relative URL's not allowed by current validates_format_of :with parameter; where the text says: "Put some images in the public/images directory and enter some product descriptions, and the resulting product listing might look something like Figure 6.7, on the next page.", the current validation functionality in the model (/depot/app/models/product.rb) will not allow the correct relative url (i.e. /images/sk_utc_small.jpg) to be entered, since it requires a full URL.
In the downloadable code for depot4/app/models/product.rb, the regular expression should be commented out or deleted, and replaced with one allowing relative url's for the images.
And this should be among the modifications mentioned in the text for Iteration A4.--Victor Kane #24254: Relative URL's not allowed by current validates_format_of :with parameter; where the text says: "Put some images in the public/images director ...more...
|
P4.0
08-Mar-06
|
|
| 65 |
|
#25311: ":post => true" is missing after :confirm => "are you sure?".
Without this you cannot destroy anything :)
Feedback to Kagejin0@yahoo.fr --Koguma
|
P4.0
21-Jun-06
|
|
|
69 |
#25734: The list action for Destroy as it is in the book didn't work for me: Clicking Destroy would pop up the confirmation dialog, but choosing ok would just refresh the list but not delete the product. After looking at the initially generated scaffolding code, I've noticed that this included an additional parameter
:post => true
After I changed the whole line to
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?", :post => true %>
the destroy action worked as expected.
PS: It might be a version issue. I've observed it with Rails 1.1.6
PPS: I have the 5th printing, February 06. This not available from the version drop down box.--Stefan Moser #25734: The list action for Destroy as it is in the book didn't work for me: Clicking Destroy would pop up the confirmation dialog, but choosing ok wo ...more...
|
P6.0
17-Aug-06
|
|
|
69 |
#24228: The text starting: 'put some images in the public/images directory' led me to think that the correct url for the images in the production form was /public/images/xxx.jpg Actually, after some considerable head scratching, it turns out the base for static resources is public, so the correct href is /images/xxx.jpg. The text gives no inkling of this..--Michael Karliner #24228: The text starting: 'put some images in the public/images directory' led me to think that the correct url for the images in the production form ...more...
|
P4.0
03-Mar-06
|
|
|
69 |
#24313: The images do not display when added in relative format.
In the list.rhtml file you should use
<img width="100" height="80" src="/depot/images/<%= product.image_url %>" /> instead. Then when adding an image just add the image name. It would be bad practice to use images that begin with http: anyway, especially if those images are from another site.--scottrad #24313: The images do not display when added in relative format.
In the list.rhtml file you should use
<img width="100" height="80" src="/depot/ima ...more...
|
P4.0
17-Mar-06
|
|
| 71 |
|
#24420: We’ll also take this opportunity to tidy up the index.rhtml view in app/views.
it should be: app/views/store--kibo
|
P4.0
07-Apr-06
|
|
| 71 |
|
#23965: This is the first time depot.css is mentioned. It has to be included in the project for proper view display. Needs to be copied from the sample code.--james patrick mclemore #23965: This is the first time depot.css is mentioned. It has to be included in the project for proper view display. Needs to be copied from the sam ...more...
|
P4.0
18-Jan-06
|
|
| 71 |
|
#26291: I'd rather remove the line numbers from listing of layout store.rhtml. With line numbers this sample is uncomfortable to copy/paste.
|
P6.0
18-Oct-06
|
|
|
73 |
#26711: The suggested code does not work for me but I found the right code elsewhere in the code bundle - detail here to avoid unititiated Product: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6b7333e92877c94d/8cd2f0bde6dd1a3f--Tom Coady #26711: The suggested code does not work for me but I found the right code elsewhere in the code bundle - detail here to avoid unititiated Product: ht ...more...
|
P1.0
04-Dec-06
|
|
| 76 |
|
#24091: As was previously stated, " In the implementaion of find_cart, the 3rd line reads "session[:cart] ||=Cart.new" This line should read "@cart = session[:cart] ||= Cart.new" " I ran into an issue in which if I accessed /store or /store/display_cart directly in a fresh (meaning session cookie-less) browser window, I could refresh the page as many times as I want and keep the same session, however if I added an item to the cart or otherwise changed pages in the browser, it would set a new cookie everytime (even everytime I refreshed the new page). Making the change noted in the quote above fixed the issue. I'm running Ruby 1.8.2, Rails 1.0.0 on a Win XP Pro SP2 pc, and I caught the error by adding the line <%= debug session %> to both my index.rhtml and display_cart.rhtml (in store views). #24091: As was previously stated, " In the implementaion of find_cart, the 3rd line reads "session[:cart] ||=Cart.new" This line should read "@cart = ...more...
|
P4.0
09-Feb-06
|
|
| 76 |
|
#24888: At first sight this approach to database maintenance is
attractive--Gordon Thiesfeld
|
P4.0
17-May-06
|
|
| 76 |
|
#25164: As pointed out before, there is an error in
session[:cart] ||= Cart.new
I replaced the code with
session[@cart] ||= Cart.new
and it magically worked again
Need someone to explain this to me
#25164: As pointed out before, there is an error in
session[:cart] ||= Cart.new
I replaced the code with
session[@cart] ||= Cart.new
and it magi ...more...
|
P4.0
03-Jun-06
|
|
| 79 |
|
#23187: The hyperlink to page 474 that describes the << operator points to page 473.--Stephen Touset
|
P2.0
20-Aug-05
|
|
|
80 |
#25862: I made all the additions to the code to the end of making the cart
I get the rails error:
"You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.size"
I don't know how to fix this--Gerry #25862: I made all the additions to the code to the end of making the cart
I get the rails error:
"You have a nil object when you didn't expect ...more...
|
P6.0
07-Sep-06
|
|
|
81 |
#24329: IWhen I run the sql at the bottom of the page to create the new table, I get an error "ERROR 1005 at line 13: Can't create table '.\depot_development\line_items.frm' <errno: 150>"
MySQL (I'm running 4.0.16) needs an index to be declared on the foreign key can be created. Like so:
create table line_items (
id int not null auto_increment,
product_id int not null,
quantity int not null default 0,
unit_price decimal(10,2) not null,
primary key (id),
index ix_line_items (product_id),
constraint fk_items_product foreign key (product_id) references products(id)
) TYPE=InnoDB;
Also MyIsam is the default table type, so I've forced innodb for the foreign key support. Not sure if that would have affected anything though.--Nick Coyne #24329: IWhen I run the sql at the bottom of the page to create the new table, I get an error "ERROR 1005 at line 13: Can't create table '.\depot_deve ...more...
|
P3.1
18-Mar-06
|
|
|
81 |
#25904: similar to the error already reported...
ERROR 1064 (42000) at line 12: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
product_id int not null,
quantity int not null default 0,
unit_price decimal' at line 2
(mysql 5.0.21)
typing the code as is on the bottom of 81, mySQL is kicking back this error. help?--dave rupert #25904: similar to the error already reported...
ERROR 1064 (42000) at line 12: You have an error in your SQL syntax; check the manual that corresp ...more...
|
P1.0
12-Sep-06
|
|
| 81 |
|
#25318: items.sizes is nil !!!
|
P4.0
22-Jun-06
|
|
| 82 |
|
#24395: Others have mentioned this error and I've tried all their suggestions but I can't get any to work. Upon testing the cart to see if it will return the @item.size of the cart's contents I get an error of:
NoMethodError in Store#display_cart
Showing app/views/store/display_cart.rhtml where line #2 raised:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.size
Now what? I've rebooted the WebBrick server. Killed the browser window after deleting all the cookies, session data, etc. I'm using RadRails so I closed it as well. Booted the server back up from a command line and get the same option. I've searched the internet through and tons of users have had this problem but there are no solutions.
Please, oh please, help!--Philip Joyner #24395: Others have mentioned this error and I've tried all their suggestions but I can't get any to work. Upon testing the cart to see if it will ret ...more...
|
P4.0
31-Mar-06
|
|
| 83 |
|
#24335: find:
Using the model declaration forces Rails to load the user model class early,
replace with:
Using the model declaration forces Rails to load the cart model class early,
explanation: you're talking about the "cart" model not the "user" model. #24335: find:
Using the model declaration forces Rails to load the user model class early,
replace with:
Using the model declaration forces Rails ...more...
|
P4.0
20-Mar-06
|
|
| 84 |
|
#24393: The online version of the file for '...app/models/cart.rb' (http://media.pragprog.com/titles/rails/code/depot9/app/models/cart.rb) differs in the fourth last line from the class definition in the book.
Book (pp 83-4):
...
@total_price += item.unit_price
...
Downloadable file 'cart.rb':
...
@total_price += product.price
...
The dowloadable file seems to be correct.--Gus Gollings #24393: The online version of the file for '...app/models/cart.rb' (http://media.pragprog.com/titles/rails/code/depot9/app/models/cart.rb) differs in ...more...
|
P4.0
30-Mar-06
|
|
|
85 |
#23910: The display_cart method on this page must be placed in the store controller *before* the private declaration line that's already in that class definition. I may be the only person who is paying so close attention to getting the method right that I overlook this placement but doing so results in an extended (and informative) debugging session as Rails complains it has no method called "display_cart".--Dan Shafer #23910: The display_cart method on this page must be placed in the store controller *before* the private declaration line that's already in that class ...more...
|
P3.1
02-Jan-06
|
|
|
85 |
#24422: In reference to problem #2532, "You have a nil object when you didn't expect it!", I also ran into the problem in chapter 8. I typoed a simple part of the application, tested it, fixed the typo, then got that error no matter what I tried (even deleting everything and typing it up again). The answer was indeed to delete session data: depot/tmp/sessions--April #24422: In reference to problem #2532, "You have a nil object when you didn't expect it!", I also ran into the problem in chapter 8. I typoed a simpl ...more...
|
P2.0
07-Apr-06
|
|
|
85 |
#26229: When looking at "depot/public/store/display_cart" with my browser I was getting the error:
undefined local variable or method `find_cart' for #<StoreController:0x4080b768>
I then checked the downloadable Code snippets and noticed the find_cart method defined in File 75. I added this method to my code (as I was typing it from the book) and things worked.
It should say in the book to add the find_cart method (it doesn't).
(note: the version I'm using is:
Third Printing, September 2005
Version: 2005-9-13
(the closest option to submit this erratum was P3.0 - September 29))--Sean Lerner #26229: When looking at "depot/public/store/display_cart" with my browser I was getting the error:
undefined local variable or method `find_cart' f ...more...
|
P3.0
12-Oct-06
|
|
|
85 |
#24256: Re #2532 - This also happend to me running under Webrick. The solution was to both close the browser and restart Webrick. Hope this helps the other reader.--brian #24256: Re #2532 - This also happend to me running under Webrick. The solution was to both close the browser and restart Webrick. Hope this helps th ...more...
|
P1.0
09-Mar-06
|
|
| 86 |
|
#29669: Concerning the invalid IDs of objects in the URL line: it is not certain that an exception will always be thrown. I assume that the ID field, extracted from the URL, is transformed to a number without any checks made. So if there is a product with ID=0 in the database, it is actually added in the cart! This is way worse than crackers looking at an exception report page! One solution is to make sure somehow that the database starts counting from 1, but this doesn't make me feel secure enough. I believe that there should be further error checks on the ID parsing level.--Nikos Mouchtaris #29669: Concerning the invalid IDs of objects in the URL line: it is not certain that an exception will always be thrown. I assume that the ID field, ...more...
|
P1.0
16-Sep-07
|
|
|
87 |
#24448: In regard to the common error
"NoMethodError in Store#display_cart
Showing app/views/store/display_cart.rhtml where line #5 raised:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
"
I found that I had a typo in the store_controler.rb
I had entered.
---
def display_cart
@cart = find_cart
@items = @cart_items
end
---
but correct code is
---
def display_cart
@cart = find_cart
@items = @cart.items
end
---
Oh the joys of being a newbie!!! 5 hours of head scratching for that one!--glenn #24448: In regard to the common error
"NoMethodError in Store#display_cart
Showing app/views/store/display_cart.rhtml where line #5 raised:
You ...more...
|
P4.0
12-Apr-06
|
|
|
88 |
#24296: Editing cart.rb in order to enable the quantity to increment requires a WebTrick restart to work properly.--Bob Clewell
|
P2.0
15-Mar-06
|
|
| 90 |
|
#24288: The file link beside "<% @page_title = "Your Pragmatic Cart" -%>" is File 29. File 29 contains the fmt_dollars() helper. fmt_dollars() isn't defined until later on PDF p93. Perhaps the file link on PDF p90 should be to a version of display_cart.rhtml without fmt_dollars?--David Hislop #24288: The file link beside "<% @page_title = "Your Pragmatic Cart" -%>" is File 29. File 29 contains the fmt_dollars() helper. fmt_dollars() isn't d ...more...
|
P4.0
13-Mar-06
|
|
| 96 |
|
#24860: Unable to create the session table.
C:\apps\ruby\files\work\depot>rake --trace db:session:create
(in C:/apps/ruby/files/work/depot)
rake aborted!
Don't know how to build task 'db:session:create'
c:/apps/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1449:in `[]'
c:/apps/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:455:in `[]'
c:/apps/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
c:/apps/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
c:/apps/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
c:/apps/ruby/bin/rake.bat:25
--Dave Pawson #24860: Unable to create the session table.
C:\apps\ruby\files\work\depot>rake --trace db:session:create
(in C:/apps/ruby/files/work/depot)
rake ...more...
|
P4.0
15-May-06
|
|
|
96 |
#25138: Flash messages are not displaying correctly using IE 6 sp2.
Results of invalid add_to_cart, empty_cart, etc no flash message appears to display.
Resizing IE window with mouse, flash message appears & disappears.
Resizing IE window with F11 key yields flash menu with missing bottom red line of the flash box.
Hitting key F11 to maximize IE, flash message displays --Steven #25138: Flash messages are not displaying correctly using IE 6 sp2.
Results of invalid add_to_cart, empty_cart, etc no flash message appears to dis ...more...
|
P3.0
31-May-06
|
|
|
98 |
#23580: using the fmt_dollars(item.unit_price) method, values less than 1, (values < 1) on the display_cart details show up as 0.00 but get added correctly to the total.--Jeff Bell #23580: using the fmt_dollars(item.unit_price) method, values less than 1, (values < 1) on the display_cart details show up as 0.00 but get added corr ...more...
|
P2.0
22-Nov-05
|
|
| 98 |
|
#24003: render_partial "form"
is now
render :partial => "form"--Dave Myron
|
P4.0
31-Jan-06
|
|
| 98 |
|
#50174: Destroy link does still not work, even if
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:post => true %>
as suggested here is used instead of the used code in the book, which does not work either. It simply creates a link like: localhost:3000/products/10
But this only shows the products attributes and an edit link plus a back link. #50174: Destroy link does still not work, even if
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
...more...
|
P6.0
17-Nov-12
|
|
| 99 |
|
#25348: In "Putting Session in the Database", theres an extra "that." in the first paragraph (First, we--Jose Guerra
|
P4.0
27-Jun-06
|
|
| 99 |
|
#24239: Since file names can contain dashes (-) in them, it never struck me that check-out.rhtml was actually checkout.rhtml until I went to test the page. While a - in publishing means that a word is continued on the next line, it was misleading to me since it just so happened to be a file name that it was connecting to on the next line.--Ryan Prins #24239: Since file names can contain dashes (-) in them, it never struck me that check-out.rhtml was actually checkout.rhtml until I went to test the ...more...
|
P4.0
06-Mar-06
|
|
| 101 |
|
#26216: @order.line_items << @cart.items has to be @order.LineItems << @cart.items otherwise, ruby will report an unknown method "line_items" for the order object.--Volker #26216: @order.line_items << @cart.items has to be @order.LineItems << @cart.items otherwise, ruby will report an unknown method "line_items" for the ...more...
|
B1.0
10-Oct-06
|
|
|
103 |
#26369: 103 describes nirvana as a state of being, but it is really a state of not-being.--William Henderson
|
P6.0
24-Oct-06
|
|
| 103 |
|
#25340: Not filling the 4 fields is will highlight them correctly, but there is no message as shown on the screen copy.--koguma
|
P4.0
26-Jun-06
|
|
|
105 |
#23872: When I write code as in file 36:
options = [["select a payment option", ""]] + Order::PAYMENT_TYPES
select( "order", "pay_type", options)
I see an exception thrown by select. It expects the options parameter to respond to the "stringify_keys" method -- which array does not respond to. When I use a Hash instead of an array it works -- but unfortunately, I lose control over the ordering of the items by doing so. --Bill Burcham #23872: When I write code as in file 36:
options = [["select a payment option", ""]] + Order::PAYMENT_TYPES
select( "order", "pay_type", options)
...more...
|
P3.0
21-Dec-05
|
|
|
105 |
#24216: The file name checkout.rhtml is hyphenated to check-out.rhtm in paragraph 3. This is the only reference to the file name on the page where the code is set out.
If you use the hyphenated form, errors occur later on (page 108). checkout.rhtml is the correct name.--Rob Nichols #24216: The file name checkout.rhtml is hyphenated to check-out.rhtm in paragraph 3. This is the only reference to the file name on the page where the ...more...
|
P4.0
28-Feb-06
|
|
|
108 |
#24213: The code in checkout.rhtml that displays the error message is given as:
<%= error_messages_for(:order) %>
This works fine if there is an error present. However, when initially connecting to the page I get the error:
-------------------------------------------------
NoMethodError in Store#check-out
Showing app/views/store/check-out.rhtml where line #2 raised:
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.errors
Extracted source (around line #2):
1: <% @page_title = "Checkout" -%>
2: <%= error_messages_for(:order) %>
3: <%= start_form_tag(:action => "save_order") %>
4: <table>
5: <tr>
RAILS_ROOT: c:/web/depot/public/../config/..
-------------------------------------------------
It seems that on initial access a nil object is passed to error_messages_for.
However, if I change the line to:
<%= error_messages_for(:order) if @order %>
so that the presence of an object "order" is checked before passing anything to error_messages_for, the page works on opening from new and still displays the errors correctly.--Rob Nichols #24213: The code in checkout.rhtml that displays the error message is given as:
<%= error_messages_for(:order) %>
This works fine if there is an ...more...
|
P4.0
28-Feb-06
|
|
|
108 |
#24215: The problem with "error_message_for(:order)" occurs if you have named the page check-out.rhtml as given on page 105. If you correct the page name to checkout.rhtml, the page works correctly.--Rob Nichols #24215: The problem with "error_message_for(:order)" occurs if you have named the page check-out.rhtml as given on page 105. If you correct the page n ...more...
|
P4.0
28-Feb-06
|
|
|
109 |
#23894: Adding the scaffold stylesheet to the store layout seems to disable any formatting from the depot stylesheet. It doesn't seem to matter which I list first--scaffold styling always overrides (even though in html source the order does change). I've tried both firefox and ie. Interestingly, I looked in the download files and neither the chapter 9 nor the chapter 10 versions of the store layout files link to the scaffold stylesheet. #23894: Adding the scaffold stylesheet to the store layout seems to disable any formatting from the depot stylesheet. It doesn't seem to matter which ...more...
|
P4.0
30-Dec-05
|
|
|
109 |
#24473: #2855: The test "Just as with the administration validation, we need to add the scaffold.css styolesheet to our store layout file to get decent formatting for these errors.
<%= stylesheet_link_tag "scaffold", "depot", :media => "all" %>"
This was confusing for me at first as I thought it was meaning to add this entire line to the app\views\layout\store.rhtml file. When I checked the file this line existed.
What you really mean was that the string "scaffold" needs to be included as an argument to the stylesheet_link_tag call.
old <%= stylesheet_link_tag "depot", :media => "all" %>
new <%= stylesheet_link_tag "scaffold", "depot", :media => "all" %>
Looking back it seems easy but 30 minutes of confusion for me!
--glenn #24473: #2855: The test "Just as with the administration validation, we need to add the scaffold.css styolesheet to our store layout file to get decen ...more...
|
P4.0
13-Apr-06
|
|
|
109 |
#24289: There is an issue with the cascading style sheets being used here. The problem is that both the scaffold and depot stylesheets are combining to produce strange text size and the scaffold stylesheet is overriding the depot stylesheet's link and link-hover code. (it seems to be thse use of pt, px, ex, em text sizes... setting sizes then uses percentages of those newly set sizes) I believe this is an issue of IE and FireFox dealing with CSS differnetly than whatever browser/version the author wrote these examples with. We need a fix for this... almost everyone on the internet uses IE or FireFox.--Brian #24289: There is an issue with the cascading style sheets being used here. The problem is that both the scaffold and depot stylesheets are combining t ...more...
|
P2.0
13-Mar-06
|
|
|
115 |
#24141: "and a slightly different interaction style to the one we've been using so far." -> "... interaction style than the one we've been using so far."--Justin Johnson
|
P2.0
16-Feb-06
|
|
| 116 |
|
#26928: This may be a simple erratum. In the 7th row of the code, where in the function of ship, the "#{count_text} marked as shipped" should be "has shipped". --Ian #26928: This may be a simple erratum. In the 7th row of the code, where in the function of ship, the "#{count_text} marked as shipped" should be "has ...more...
|
P6.0
01-Feb-07
|
|
| 116 |
|
#23947: The code given for the ship method should not include the check (if count > 0) if you want to be able to show the intended message "No orders marked as shipped" flash message when no items are checked off before submitting the form.
--Alan M #23947: The code given for the ship method should not include the check (if count > 0) if you want to be able to show the intended message "No orders ...more...
|
P4.0
16-Jan-06
|
|
|
119 |
#24334: The admin.css file is not included in the code download, so we need to type this in manually :(--Nick Coyne
|
P3.1
19-Mar-06
|
|
|
119 |
#24472: The test "Just as with the administration validation, we need to add the scaffold.css styolesheet to our store layout file to get decent formatting for these errors.
<%= stylesheet_link_tag "scaffold", "depot", :media => "all" %>"
This was confusing for me at first as I thought it was meaning to add this entire line to the app\views\layout\store.rhtml file. When I checked the file this line existed.
What you really mean was that the string "depot" needed to be included as an argument to the stylesheet_link_tag call.
old <%= stylesheet_link_tag "depot", :media => "all" %>
new <%= stylesheet_link_tag "scaffold", "depot", :media => "all" %>
Looking back it seems easy but 30 minutes of confusion for me!--glenn #24472: The test "Just as with the administration validation, we need to add the scaffold.css styolesheet to our store layout file to get decent forma ...more...
|
P4.0
13-Apr-06
|
|
| 120 |
|
#24162: The code snippet given for login_controller.rb is missing an "end" statement at the end of it to close :
class LoginController < ApplicationController
--BrianWarren #24162: The code snippet given for login_controller.rb is missing an "end" statement at the end of it to close :
class LoginController < Applicatio ...more...
|
P4.0
21-Feb-06
|
|
|
122 |
#26252: The ship method only calls the pluralize method if the count is greater than 1:
def ship
count = 0
if things_to_ship = params[:to_be_shipped]
count = do_shipping(things_to_ship)
if count > 0
count_text = pluralize(count, "order")
flash.now[:notice] = "#{count_text} marked as shipped"
end
end
@pending_orders = Order.pending_shipping
end
Though the pluralize method has functionality to handle a zero checked for shipping submission:
def pluralize(count, noun)
case count
when 0: "No #{noun.pluralize}" # -- THIS ISN'T BEING UTILIZED
when 1: "One #{noun}"
else "#{count} #{noun.pluralize}"
end
end
I suggest removing the code that checks to see if the count is greater than one and instead always call the pluralize method:
def ship
count = 0
if things_to_ship = params[:to_be_shipped]
count = do_shipping(things_to_ship)
# REMOVED -- if count > 0
count_text = pluralize(count, "order")
flash.now[:notice] = "#{count_text} marked as shipped"
# REMOVED -- end
end
@pending_orders = Order.pending_shipping
end
Thanks,
Sean
sean@ttcrider.ca--Sean Lerner #26252: The ship method only calls the pluralize method if the count is greater than 1:
def ship
count = 0
if things_to_ship = params[:to ...more...
|
P3.0
14-Oct-06
|
|
| 122 |
|
#24217: The Login controller's "Add User" picture is incorrect. It has the stylesheet applied and looks much fancier.--Miles K. Forrest
|
P4.0
28-Feb-06
|
|
|
122 |
#24518: in File 48 (listed on page 122) -- the Pluralize method returns an error of 'undefined method' for 'pluralize'
|
P4.0
22-Apr-06
|
|
| 126 |
|
#22678: "Have a look at the source of the controller on page 478 and of the view on page 486."
The link to page 478 goes to page 475, and the link to page 486 goes to page 483.--Nathan Wright #22678: "Have a look at the source of the controller on page 478 and of the view on page 486."
The link to page 478 goes to page 475, and the link ...more...
|
B1.0
04-Jun-05
|
|
| 126 |
|
#24218: Link to page 490 actually goes to 487, and 498 goes to 495--Miles K. Forrest
|
P4.0
28-Feb-06
|
|
|
130 |
#26190: Whenever I try to add the initial user I am just forwarded to login/login. Is there another way just to add 1 user?--Sean
|
P6.0
08-Oct-06
|
|
|
134 |
#24131: The delete_user action uses a symbol reference for the redirection:
redirect_to(:action => :list_users)
While this obviously works it is a little confusing when in most similar cases you reference by a string:
redirect_to(:action => "index")
It seems as the references are interchangable in this context, but when writing test they are not - the same type must be used in the assert_redirected_to clause as in the controller.
It would be great to have a notice about the possible different coding styles, and the implications for the tests.
Maybe you could elaborate on wheter consistency is desirable as well.
(Or you could just change the reference, but that wouldn't be as interesting.)
--Daniel #24131: The delete_user action uses a symbol reference for the redirection:
redirect_to(:action => :list_users)
While this obviously works it is a l ...more...
|
P3.0
14-Feb-06
|
|
| 134 |
|
#24004: It seems that the generator for unit tests no longer generates the setup method (Rails 1.0.0) so the code in the PDF/Book doesn't match watch is actually produced.--Dave Myron #24004: It seems that the generator for unit tests no longer generates the setup method (Rails 1.0.0) so the code in the PDF/Book doesn't match watch ...more...
|
P4.0
31-Jan-06
|
|
| 138 |
|
#24246: the "assert_equal 29.95, @product.price" fails for me, even though product.price is 29.95. The only way to make this assert to pass it was changing the line to "assert_equal 29.95.to_s, @product.price.to_s" #24246: the "assert_equal 29.95, @product.price" fails for me, even though product.price is 29.95. The only way to make this assert to pass it was ch ...more...
|
P4.0
07-Mar-06
|
|
| 139 |
|
#24182: You might want to make mention of looking at the code for this test section. You tend to be very brief in your explanation and tend to leave the reader a little lost unless they aggressively hunt down the details of the code, etc.
For instance, setup() is never mentioned until *after* you say the code works. Likewise, as another user noted, the details of categories.yml aren't mentioned and just seem to confuse the matter as you don't appear to use it in your reference code. You may want to omit the latter bit, or make it a footnote.--James #24182: You might want to make mention of looking at the code for this test section. You tend to be very brief in your explanation and tend to leave ...more...
|
P4.0
22-Feb-06
|
|
| 140 |
|
#24315: Following the book, the create.sql creates MyISAM tables in MySQL by default. To change these later, use:
ALTER TABLE depot_test.products ENGINE=InnoDB;
or you can add ENGINE=InnoDB just before the semicolons in the create.sql CREATE TABLE statements.--Rufus #24315: Following the book, the create.sql creates MyISAM tables in MySQL by default. To change these later, use:
ALTER TABLE depot_test.products E ...more...
|
P4.0
17-Mar-06
|
|
| 141 |
|
#24340: Maybe it helps someone: here is the correct code for test_read_with_fixture_variable:
def test_read_with_fixture_variable
assert_kind_of Product, @product
assert_equal products(:version_control_book).id, @product.id
assert_equal products(:version_control_book).title, @product.title
assert_equal products(:version_control_book).description, @product.description
assert_equal products(:version_control_book).image_url, @product.image_url
assert_equal products(:version_control_book).price, @product.price
assert_equal products(:version_control_book).date_available, @product.date_available
end #24340: Maybe it helps someone: here is the correct code for test_read_with_fixture_variable:
def test_read_with_fixture_variable
assert_kind_ ...more...
|
P4.0
21-Mar-06
|
|
| 141 |
|
#24444: If you are getting the error about @products being nil then set use_instantiated_fixtures = true in test/test_helper.rb.--Luca Spiller
|
P4.0
11-Apr-06
|
|
| 141 |
68 |
#23938: As a side bar it would have been nice to have been warned about strftime and how our database with empty or default 0000-00-00 00:00:00 values for date_available would cause the application to fail.
I'm new to ROR and Ruby so, sorry if this is a known / given.
--Hezekia McMurray #23938: As a side bar it would have been nice to have been warned about strftime and how our database with empty or default 0000-00-00 00:00:00 values ...more...
|
P1.0
11-Jan-06
|
|
| 141 |
|
#24295: New to RoR, so this might be the same as the erratum beginning "With the new testing rules, a good chunk ".
In the test_read_with_hash method, the line
vc_book = @products["version_control_book"]
fails because @products is nil, i.e. does not seem to have been filled in.
Similarly, in the test_read_with_fixture_variable method, the line
assert_equal @version_control_book.id, @product.id
fails because @version_control_book is nil.--David Hislop #24295: New to RoR, so this might be the same as the erratum beginning "With the new testing rules, a good chunk ".
In the test_read_with_hash method ...more...
|
P4.0
14-Mar-06
|
|
| 142 |
|
#23879: Figure 12.1 suggests the members of the @products hash are Product objects coming from the database, as @version_control_book is. This is misleading because the @products hash contains Fixtures. in particular with the former @product.data_available_before_type_cast is needed in the equals assertion, whereas in the latter @product.data_available works.--Xavier Noria #23879: Figure 12.1 suggests the members of the @products hash are Product objects coming from the database, as @version_control_book is. This is misl ...more...
|
P3.1
24-Dec-05
|
|
| 143 |
|
#23850: If you make a mistake in the yaml for the entry @future_proof_book, you won't be told if it doesn't exist and it will silently pass as it resolves to nil. I added:
unavailable_item = @future_proof_book
assert_not_nil unavailable_item
assert !items.include?(unavailable_item)
to catch that possibility.--Yan-Fa Li #23850: If you make a mistake in the yaml for the entry @future_proof_book, you won't be told if it doesn't exist and it will silently pass as it reso ...more...
|
P3.1
15-Dec-05
|
|
|
144 |
#24142: "... then paying his valid credit card..." -> "... then paying with his valid credit card ..."--Justin Johnson
|
P2.0
16-Feb-06
|
|
| 146 |
|
#24005: test_helper.rb looks (mostly) nothing like the example in the PDF.
It now looks like:
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
# between every test method. Fewer database queries means faster tests.
#
# Read Mike Clark's excellent walkthrough at
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
#
# Every Active Record database supports transactions except MyISAM tables
# in MySQL. Turn off transactional fixtures in this case; however, if you
# don't care one way or the other, switching from MyISAM to InnoDB tables
# is recommended.
self.use_transactional_fixtures = false
# Instantiated fixtures are slow, but give you @david where otherwise you
# would need people(:david). If you don't want to migrate your existing
# test cases which use the @david style and don't mind the speed hit (each
# instantiated fixtures translates to a database query per test method),
# then set this back to true.
self.use_instantiated_fixtures = true
# Add more helper methods to be used by all tests here...
end
--Dave Myron #24005: test_helper.rb looks (mostly) nothing like the example in the PDF.
It now looks like:
ENV["RAILS_ENV"] = "test"
require File.expand_pat ...more...
|
P4.0
31-Jan-06
|
|
|
147 |
#23885: test_helper.rb must be updated in order for the test_destroy method to be used if the MySQL database is using MyISAM tables (the default for CocoaMySQL). One must set "self.use_transactional_fixtures = false"--Parker McGee #23885: test_helper.rb must be updated in order for the test_destroy method to be used if the MySQL database is using MyISAM tables (the default for C ...more...
|
P3.0
27-Dec-05
|
|
|
148 |
#23887: Rails has recently, in 1.0, updated the way it handles fixtures. If you're having problems, see Mike Clark's weblog here: http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting--Parker McGee #23887: Rails has recently, in 1.0, updated the way it handles fixtures. If you're having problems, see Mike Clark's weblog here: http://clarkware.co ...more...
|
P3.0
28-Dec-05
|
|
|
148 |
#24022: The @products and @version_control_book instance variables are not available unless you set the 'use_instantiated_fixtures' attribute to true. This can be set in the TestCase class Rails creates for you.--Cathal #24022: The @products and @version_control_book instance variables are not available unless you set the 'use_instantiated_fixtures' attribute to true. ...more...
|
P3.0
03-Feb-06
|
|
|
148 |
#24561: when running test_read_with_hash omitting the before_type_cast suffix to the date assertion seems to allow the test to pass - including it causes a mismatch between the hashed fcture date and that called from test.database --laura herald #24561: when running test_read_with_hash omitting the before_type_cast suffix to the date assertion seems to allow the test to pass - including it cau ...more...
|
P4.0
01-May-06
|
|
|
151 |
#23261: Maybe I'm not quite understanding what Mike is saying (in the context of using a dynamic fixture to 'future-proof' the test of salable_items). He says "Perhaps we should refactor the salable_items() method to take a date as a parameter. That way we could unit test the salable_items() method simply by passing in a future date to the method...".
It would seem that instead of passing in a 'future' date. You'd want to send in a known, fixed, date that would be prior to the one in the fixture for the future-proof book.
I'm thinking it as salable_items AS OF a supplied date,
and typically it would be today's date in production, but could be fixed for tests.--Richard Jensen #23261: Maybe I'm not quite understanding what Mike is saying (in the context of using a dynamic fixture to 'future-proof' the test of salable_items). ...more...
|
P1.0
27-Sep-05
|
|
|
152 |
#28629: in your tests, you are testing the equality of ambiguous numbers (floats). The prices you chose for the fixtures just _happen_ to work, but other prices will cause this error:
1) Failure:
test_add_unique_products(CartTest) [test/unit/cart_test.rb:15]:
<#<BigDecimal:b74e84fc,'0.5988E2',8(16)>> expected but was
<59.88>.
use (for example)
assert_equal sprintf("%0.2f", (@version_control_book.price + @automation_book.price) ), sprintf("%0.2f", @cart.total_price)--Andrew Yates #28629: in your tests, you are testing the equality of ambiguous numbers (floats). The prices you chose for the fixtures just _happen_ to work, but ot ...more...
|
P3.0
19-Apr-07
|
|
| 156 - 159 |
|
#24080: The file examples for store_controller.rb thoughout this section contain arguments to the fixture() method that look like this.
fixtures :products, :orders.
Having both these fixtures referenced causes ActiveRecord::StatementInvalid: Mysql::Error: type errors to be raised when the test is run.
This appears to be the result of the fact that orders.yml at this point has not been modified, and contains the default generated values that Rails provides. The errors specifically mention that the orders table does not specify default values that the ActiveRecord tries to insert into this table using such assign statements as assert_equal 1, assigns(:items).size.
The addition of the necessary fixture information to oreders.yml is discussed at the end of this section, and unless I'm mistaken, has not been suggested before this.
Perhaps this will help others to trace this problem without wasting much time.--m gentzel #24080: The file examples for store_controller.rb thoughout this section contain arguments to the fixture() method that look like this.
fixtures :pro ...more...
|
P4.0
07-Feb-06
|
|
|
156 |
#24441: Book Version 2005-12-20. Running "ruby test/functional/login_controller_test.rb" produces error: "method 'before_destroy' for LoginController:Class (NoMethodError)". I comment out the "before_destroy dont_destroy_dave" line from login_controller.rb and I get the result specified in the book (the "302" error). Being new at ruby/rails (learning directly from this book) not sure how to fix this... (running 1.8.2 on XPPro)--Martin Crundall #24441: Book Version 2005-12-20. Running "ruby test/functional/login_controller_test.rb" produces error: "method 'before_destroy' for LoginController ...more...
|
P4.0
11-Apr-06
|
|
|
159 |
#24197: This may be a Ruby/Rails version problem (Ruby 1.8.2, Rails 1.0.0). The session array is problematic. I see examples with it as a global variable (your book) and as a session variable (e.g., Four Days on Rails). Confusing, but not your fault. However, on my version(s), session is not a global variable in the functional test code, it is a field of @request. This makes sense to me and my code runs.--Jeffrey L. Taylor #24197: This may be a Ruby/Rails version problem (Ruby 1.8.2, Rails 1.0.0). The session array is problematic. I see examples with it as a global var ...more...
|
P3.0
25-Feb-06
|
|
| 166 |
|
#27028: The listing of application.rb is inaccurate. It should include the following lines just after the class declaration:
# Pick a unique cookie name to distinguish our session data from others'
session :session_key => '_depot_session_id'
--Tom Pollard #27028: The listing of application.rb is inaccurate. It should include the following lines just after the class declaration:
# Pick a unique coo ...more...
|
P4.0
23-Feb-07
|
|
| 169 |
|
#24297: File 121 online (http://media.pragprog.com/titles/rails/code/depot_testing/test/performance/order_test.rb) doesn't quite match the code on the page, nor the code from the zip file I downloaded. I didn't diff it, but at least the elapsedSeconds test is different (8.0 in the book and zip, 3.0 in the online file, probably as it once was in the book?)--David Hislop #24297: File 121 online (http://media.pragprog.com/titles/rails/code/depot_testing/test/performance/order_test.rb) doesn't quite match the code on the ...more...
|
P4.0
15-Mar-06
|
|
| 169 |
|
#24298: When running the performance test it fails with a MySQL foreign key constraint violation. Examining the test log file, it's because the first save_order after the add_to_cart generated by the code "get :add_to_cart, :id => products(:version_control_book).id" created a single line item associated with the first order. Knowing at this stage of the book how to fix situations like this by ordering the deletes after a test would be nice!--David Hislop #24298: When running the performance test it fails with a MySQL foreign key constraint violation. Examining the test log file, it's because the first ...more...
|
P4.0
15-Mar-06
|
|
| 170 |
|
#24347: The use of transactional fixtures is already standard in my version of Rails (set in test_helper.rb).--Juergen
|
P4.0
21-Mar-06
|
|
| 170 |
|
#25446: h
|
P4.0
14-Jul-06
|
|
|
176 |
#24151: Running the code listed for File 121 on Page 176 of the book (12.7 Performance Testing) produced an integrity constraint violation error from MySQL caused by the Order.delete_all statement, which attempts to deletes orders which are tied to LineItems.
Modifying the fk_items_order constraint (create.sql, file 37/106, page 102/502) to include an ON DELETE CASCADE clause resolves the problem, by removing the line item record when deleting the associated order.
ALTER TABLE line_items DROP FOREIGN KEY fk_items_order;
ALTER TABLE line_items
ADD CONSTRAINT fk_items_order FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE
I did use phpMyAdmin to create the tables and constraints, but going over it, I'm not sure why it would have worked for you guys, unless MySQL prior to 4.12 had default different behavior.--Nathan Youngman #24151: Running the code listed for File 121 on Page 176 of the book (12.7 Performance Testing) produced an integrity constraint violation error from ...more...
|
P3.0
17-Feb-06
|
|
| 183 |
|
#23936: Grouping controllers in modules: I have grouped controllers as described in this section using the command format:
myapp> ruby script/generate controller Admin::Book action1 action2 ...
FIles and directories were generated as described, however, a request formatted according to your example:
http://my.app/admin/book/edit/1234
results in an error "no action corresponds to book".--sharon #23936: Grouping controllers in modules: I have grouped controllers as described in this section using the command format:
myapp> ruby script/generat ...more...
|
P3.1
10-Jan-06
|
|
| 193 |
|
#25395: Logging In
Now that we have a user in the test database, let's see if we can log in as taht user. If we were using a browser....
----
taht should be that (This is from the beta excerpt of the testing chapter, in case you've already fixed this)--Orien Vandenbergh #25395: Logging In
Now that we have a user in the test database, let's see if we can log in as taht user. If we were using a browser....
----
...more...
|
P4.0
03-Jul-06
|
|
| 207 |
|
#24548: Order.find_on_page(page_num, page_size)
the above function defined should probably be more like,
def Order.find_on_page(page_num,page_size)
find(:all, :order => 'id', :limit => page_size, :offset => (page_num-1)*page_size)
end
note: (page_num-1)*page_size is the change--Mike Nelson #24548: Order.find_on_page(page_num, page_size)
the above function defined should probably be more like,
def Order.find_on_page(page_num,page_si ...more...
|
P4.0
27-Apr-06
|
|
| 209 |
|
#23966: To be a little more consistent, I think the line
order = Order.find_all_by_email(params['email'])
should be "orders = .... " to match the other find_all examples. #23966: To be a little more consistent, I think the line
order = Order.find_all_by_email(params['email'])
should be "orders = .... " to match t ...more...
|
P4.0
19-Jan-06
|
|
| 212 |
|
#23876: <blockquote><code>result = Product.update_all("price = 1.1*price", "title like '%Java%'") </code></blockquote>
It would have been useful if you showed the usage of like statements when you were explaining find() too. It isn't too hard to muck around and figure out, but would be a lot clearer if explicitly shown.--UltraBob #23876: <blockquote><code>result = Product.update_all("price = 1.1*price", "title like '%Java%'") </code></blockquote>
It would have been useful if ...more...
|
P3.1
23-Dec-05
|
|
| 213 |
222 |
#23948: In the bit about save vs. save! when it comes to callbacks in there too it doesn't work exactly like that either :-( Went digging and found http://dev.rubyonrails.org/ticket/1861 where they talk about it some more. --Chris Nolan.ca #23948: In the bit about save vs. save! when it comes to callbacks in there too it doesn't work exactly like that either :-( Went digging and found h ...more...
|
P4.0
17-Jan-06
|
|
| 221 |
|
#24423: With regard to assigning a new object to a has_one relationship, the text suggests the following code:
invoice = Invoice.new
# fill in the invoice
invoice.save!
an_order.invoice = invoice
When the invoice row is saved, it does not yet have a foreign key value for the order table--wouldn't this cause the SQL INSERT to be followed by an UPDATE to add the foreign key? In addition to being inefficient, what if the update fails and no error is generated? It would seem you are in the same boat so you are no better off (aside from the fact that an update is generally less likely to fail than an insert). Would a transaction help to force an error to be generated?
Also, if the invoice table does not allow a null value in order_id or has a foreign key constraint, then won't the save! method always fail? It would seem to be worth mentioning that the database table needs to be set up to allow null order_id values for this code to work.
--Michael Johnson #24423: With regard to assigning a new object to a has_one relationship, the text suggests the following code:
invoice = Invoice.new
# fill in ...more...
|
P4.0
07-Apr-06
|
|
|
226 |
#24200: "It's worth noting that it isn't the foreign keys that set up the relationships. These are just hints to the database that it should check that the values in the columns reference known keys in the target tables. The DBMS is free to ignore these constraints (and some versions of MySQL do)."
The DBMS is free to ignore these constraints? I find this statement very misleading. If MySQL ignores foreign key constraints, that is a major BUG in MySQL, nothing more. Why would a database let you define constraints and then ignore them? This is the kind of statement that makes me lose confidence in the rest of the book (which otherwise seems quite good).
Please update with a more accurate description of what foreign key constraints do. Perhaps a description of the buggy behavior of MySQL could be placed in a side bar. --Stephen Hutton #24200: "It's worth noting that it isn't the foreign keys that set up the relationships. These are just hints to the database that it should check th ...more...
|
P1.0
25-Feb-06
|
|
| 226 |
|
#24560: 6th paragraph -- "This is useful in cases where simply adding to the where clause using the :condition option isn--Rob Leslie
|
P4.0
01-May-06
|
|
|
228 |
#24383: In the second sentence: "You indicate these relationships..." the word relationships is misspelled ('relatonships').
|
P3.0
27-Mar-06
|
|
| 232 |
|
#23914: Regarding
class User < ActiveRecord::Base
has_and_belongs_to_many :articles
def read_article(article)
articles.push_with_attributes(article, :read_at => Time.now)
end
# ...
end
I am missing information on how to update-or-add articles to the list. That is, how would one best go about adding the article if it didn't exist, or just update the Time.now bit if it existed already? Haven't been able to find the answer. More generally, at least the mention of find_on_create (which isn't applicable here, I don't think?) would be a nice addition (though perhaps not on this particular page). #23914: Regarding
class User < ActiveRecord::Base
has_and_belongs_to_many :articles
def read_article(article)
articles.push_with_attri ...more...
|
P4.0
02-Jan-06
|
|
| 236 |
|
#23933: The section on counters states: "How many lines items does this order have?" but then the counter is created with the product, so instead it answers "How many lines items does the product have", which doesn't make any sense. Unless I'm completely missing something, of course...--Elan Feingold #23933: The section on counters states: "How many lines items does this order have?" but then the counter is created with the product, so instead it a ...more...
|
P1.0
10-Jan-06
|
|
|
250 |
#23873: I would really value an expansion on how to induce #error_message_for to format validation errors for objects that have been rolled back (by the transaction). The statement that "there's no easy way..." is tantalizing.--Bill Burcham #23873: I would really value an expansion on how to induce #error_message_for to format validation errors for objects that have been rolled back (by t ...more...
|
P3.0
21-Dec-05
|
|
| 261 |
|
#23930: validates_format_of: syntax coloring error in example code; "in" should be blue instead of red--Benoit Gagnon
|
P4.0
08-Jan-06
|
|
| 261 |
|
#24012: I couldn't work out really quickly how to make a test case work to see if this is true or not, but it seems like the default message for validates_exclusion_of should be “is included in the list.” instead of “is NOT included in the list.” It doesn't make sense to me that the default message for validates_exclusion_of and validates_inclusion_of should be the same.--UltraBob #24012: I couldn't work out really quickly how to make a test case work to see if this is true or not, but it seems like the default message for valid ...more...
|
P4.0
02-Feb-06
|
|
| 266 |
|
#23913: Not certain, but shouldn't the regexp in
def normalize_credit_card_number
self.cc_number.gsub!(/-\w/, '')
end
contain \s rather than \w? Assuming we want to strip whitespace rather than word characters. #23913: Not certain, but shouldn't the regexp in
def normalize_credit_card_number
self.cc_number.gsub!(/-\w/, '')
end
contain \s rather than ...more...
|
P4.0
02-Jan-06
|
|
| 267 |
|
#23917: If there is no difference between created_on and created_at, nor between updated_on and updated_at, perhaps this should be stated (even more) explicitly to avoid confusion. #23917: If there is no difference between created_on and created_at, nor between updated_on and updated_at, perhaps this should be stated (even more) ...more...
|
P4.0
02-Jan-06
|
|
| 269 |
|
#24504: The Encrypter class reads:
def initialize(attrs_to_manage)
when it should have a splat:
def initialize(*attrs_to_manage)
in order to handle multiple attributes.--Ashley Taylor #24504: The Encrypter class reads:
def initialize(attrs_to_manage)
when it should have a splat:
def initialize(*attrs_to_manage)
in order ...more...
|
P4.0
20-Apr-06
|
|
| 273 |
|
#25454: result.each do |line_item|
puts "Line item #{line_item.id}:
Should fail, as
result = LineItem.find_by_sql("select quantity,
quantity*unit_price as total_price " +
" from line_items")
Didn't fetch the id; as you point out on page 276 ("The Case of the Missing ID")--Daniel #25454: result.each do |line_item|
puts "Line item #{line_item.id}:
Should fail, as
result = LineItem.find_by_sql("select quantity,
quantity*un ...more...
|
P4.0
15-Jul-06
|
|
| 279 |
|
#24171: At the beginning of the ActiveController section(16.1) the process of the loading of an ActionController is described. There it says that the corresponding helper file is merged into the Controller (point 3). This is wrong, the helper is obviously only avaible in the View. #24171: At the beginning of the ActiveController section(16.1) the process of the loading of an ActionController is described. There it says that the ...more...
|
P4.0
22-Feb-06
|
|
| 301 |
|
#23883: If a section header is the first thing on a page, the link from the TOC will land on the page previous to the start of the section.
Also, the page numbering in the PDF is off - the number on the page says 292 but Adobe Reader or Preview (Mac OS X) report the page as 301. You should adjust the physical numbering and logical numbering so they are in sync. I don't know what you are using to prepare the PDF, but you can fix page numbers using the Adobe Acrobat tool.--Joshua Susser #23883: If a section header is the first thing on a page, the link from the TOC will land on the page previous to the start of the section.
Also, t ...more...
|
P3.0
27-Dec-05
|
|
|
302 |
#25364: "You can pass additional parameters as a hash to these named route."
"route" should be pluralized--Austin
|
P2.0
29-Jun-06
|
|
|
302 |
#23949: Shouldn't the OrderController class extend ApplicationController or ActionController... not ActiveRecord::Base?--Ben Munat
|
P3.0
17-Jan-06
|
|
| 306 |
|
#23904: I'm thinking the link to the 16.8/p323 should actually be to p310 re: Session Expiry and the :session_expiry and not to page caching?--Chris Nolan.ca
|
P4.0
01-Jan-06
|
|
| 308 |
|
#28391: You refer to "Session Container Performance in Ruby on Rails" hosted in your site. The overall picture comparison is not available (media.pragprog.com/ror/sessions/img/sessions.png) --Hugo #28391: You refer to "Session Container Performance in Ruby on Rails" hosted in your site. The overall picture comparison is not available (media.prag ...more...
|
P6.0
08-Apr-07
|
|
| 319 |
|
#24221: The first line of verify_premium_user is a return statement. That can't be correct, can it?--Jeff de Vries
|
P4.0
01-Mar-06
|
|
|
330 |
#24320: Why does verify_premium_user have a "return" statement as the first line in its definition? I believe this is a typo.--Justin Johnson
|
P4.0
17-Mar-06
|
|
| 336 |
|
#24590: In <%= number_with_delimiter(12345678, delimiter = "_") %> I suspect the second argument should be :delimiter => "_".--Rob Leslie
|
P4.0
02-May-06
|
|
| 344 |
|
#24375: and the corresponding value are the value
and the corresponding values are the value--Robin Bhattacharyya
|
P4.0
24-Mar-06
|
|
|
351 |
#24482: There is only a couple of lines about RSS. Could you please include an example of how this works both on the server side and client side. After reading this I'm not sure how Rails could be used to make an RSS server.--Peter Michaux #24482: There is only a couple of lines about RSS. Could you please include an example of how this works both on the server side and client side. Afte ...more...
|
P2.0
14-Apr-06
|
|
|
351 |
#24277: "Finally, the magic option :encode=>"javascript" uses client-side Javascript to obscure the generated link, making it harder for spiders to harvest e-mail addresses from your site."
Client side Javascript isn't used to obscure the link, but to decode an already obscured link. Spiders can't 'see' the output of Javascript functions (yet?).--bitbutter #24277: "Finally, the magic option :encode=>"javascript" uses client-side Javascript to obscure the generated link, making it harder for spiders to ha ...more...
|
P3.0
10-Mar-06
|
|
|
352 |
#24387: In the RHTML-code at the bottom of the page, inside the for user loop, the <tr> tag isn't closed. Thanks for an awesome book!--Mathias Wittlock
|
P3.0
28-Mar-06
|
|
|
357 |
#24206: In description of text fields: "common options include :size... and :maxsize..." Shouldn't the last be ":maxlength", in order to have the browser cut off input greater than specified length? --Micah Bly #24206: In description of text fields: "common options include :size... and :maxsize..." Shouldn't the last be ":maxlength", in order to have the bro ...more...
|
P4.0
26-Feb-06
|
|
|
359 |
#24356: It would be great if you showed some code to illustrate your point "in reality the find would probably be either in the controller or in a helper module".--Nick Coyne #24356: It would be great if you showed some code to illustrate your point "in reality the find would probably be either in the controller or in a hel ...more...
|
P3.1
22-Mar-06
|
|
|
362 |
#26318: I found it hard to get through the upload process. When precisely the picture= accessor is called? It is called in the model, down in ActiveRecord somewhere. Hard to explain. But a few more setneces about the need of the accessor-method would be nice.--3y #26318: I found it hard to get through the upload process. When precisely the picture= accessor is called? It is called in the model, down in ActiveRe ...more...
|
P6.0
19-Oct-06
|
|
|
363 |
#24226: The file uploading process described here is accurate, complete and helpful but it includes a sentence that makes its use potentially ambiguous. The last paragraph of text on the page says, "The picture is uploaded into an attribute called picture. However, the database table doesn't contain a column of that name."
I mis-read this to mean, in essence, "If we'd actually had a column called picture in our database, none of the following code monkeying would have been necessary." That is a wrong interpretation. The model magic is necessary whether or not the file is being uploaded to a database column called picture.--Dan Shafer #24226: The file uploading process described here is accurate, complete and helpful but it includes a sentence that makes its use potentially ambiguou ...more...
|
P4.0
02-Mar-06
|
|
|
369 |
#23964: "If the current request is being handled by a controller called store, Rails will by default look for a layout called store_layout (with the usual .rhtml or .rxml extension) in the app/views/layouts directory"
This does not work for me. I have to add a directive like this:
layout "store_layout"
in the store_controller.rb file to get the layout to work. Am I doing something wrong, or is the default layout name different from what the book says?--Richard Smith #23964: "If the current request is being handled by a controller called store, Rails will by default look for a layout called store_layout (with the u ...more...
|
P3.0
18-Jan-06
|
|
|
375 |
#23934: render_component passing the controller as a symbol generates a camelize error with rails 1.0. Various irc members also mentioned that it is a big no-no and should be passed as render_component :controller => 'name, :action => 'actionname'--John Athayde #23934: render_component passing the controller as a symbol generates a camelize error with rails 1.0. Various irc members also mentioned that it is a ...more...
|
P1.0
10-Jan-06
|
|
|
377 |
#24336: "It's in the file get_links in the component's link subdirectory." -> "It's in the file get_links.rhtml in the component's link subdirectory."--Justin Johnson
|
P4.0
20-Mar-06
|
|
| 380 |
|
#23819: Note page# is acrobat reader page# - number in header is 380
The Observer code in this section does not work. To cut a long story short the parameters get mangled when they are retrieved using @phrase = request.raw_post || request.query_string so that if you type in an r a r&_ gets sent. Instead you need to
1) Use @phrase = params[:search_text]
2) Use a :with parameter with observe_field e.g.
:with => "'search_text=' + escape(value)"
There is stuff on the wiki about this.
It would also be good if this section explained about the CTAGS code being generated by observe_field
Rails 0.14.3
Ruby 1.8.2
Windows XP
--Andrew Premdas #23819: Note page# is acrobat reader page# - number in header is 380
The Observer code in this section does not work. To cut a long story short the ...more...
|
P3.0
05-Dec-05
|
|
| 380 |
|
#24414: Unfortunately, this could be user error, but I copied and pasted the code samples directly from your site.
When I buit the AJAX guessing game, the initial page that I get looks like yours in the figures on the following page. My initial URL is "http://localhost:3000/guesswhat"
However, when I submit my answer, either a winning or losing answer, the URL changes to "http://localhost:3000/guesswhat/guess" As a result, the partial update is not performed. Instead, I get a replacement load of just the form. The "Guess What" header is not missing from the page.
I am a beginner, so this could be pilot error. I hope that I'm not wasting your time.
--Chris Kappler #24414: Unfortunately, this could be user error, but I copied and pasted the code samples directly from your site.
When I buit the AJAX guessing ga ...more...
|
P4.0
06-Apr-06
|
|
| 386 |
|
#24377: this would be not be a big deal
this would not be a big deal--Robin Bhattacharyya
|
P4.0
24-Mar-06
|
|
| 387 |
|
#26895: "... in real life it might remove a remove from a database table" should probably be "... in real life it might remove a row from a database table"
|
P6.0
28-Jan-07
|
|
|
391 |
#23839: The AJAX example using form_remote_tag() on pages 391-392 doesn't work. I downloaded the code directly from the website and tried it on Windows XP SP2 with Ruby 1.8.2-15 and Rails 0.14.4 running on WEBrick and Apache, using IE6 and Firefox 1.5 to browse, and on OS X Tiger.
The code is supposed to update a <div id="update_div> with a new form using AJAX. Instead of updating the "update_div" like it should, it renders the form as an entirely new page by itself.
WEBrick output:
127.0.0.1 - - [12/Dec/2005:10:43:28 Eastern Standard Time] "GET /guesswhat HTTP/1.1" 200 851
- -> /guesswhat
127.0.0.1 - - [12/Dec/2005:10:43:28 Eastern Standard Time] "GET /favicon.ico HTTP/1.1" 200 0
- -> /favicon.ico
127.0.0.1 - - [12/Dec/2005:10:43:32 Eastern Standard Time] "POST /guesswhat/guess HTTP/1.1" 200 623
http://localhost:3000/guesswhat -> /guesswhat/guess
It goes from "- -> /guesswhat" to "http://localhost:3000/guesswhat -> /guesswhat", which leads me to believe that something in Rails changed that is causing a misdirection somehow.--Charlie Squires #23839: The AJAX example using form_remote_tag() on pages 391-392 doesn't work. I downloaded the code directly from the website and tried it on Windo ...more...
|
P1.0
12-Dec-05
|
|
| 392 |
|
#23931: If you download File 202 (update_many.rhtml), be aware that this file is actually generating Javascript, not HTML; therefore, the embedded HTML comment causes an error when it is executed as Javascript by the browser. Solution: delete the comment, or use Javascript-style commenting--Dennis Bell #23931: If you download File 202 (update_many.rhtml), be aware that this file is actually generating Javascript, not HTML; therefore, the embedded HTM ...more...
|
P4.0
09-Jan-06
|
|
| 393 |
|
#24113: It uses a trvial partial template for each line.
"trivial"
|
P4.0
12-Feb-06
|
|
| 394 |
|
#24114: "We’ll put these in a <script> section in our page header, but the header is defined this the page template." -- grammatical typo
|
P4.0
12-Feb-06
|
|
|
395 |
#26319: "@phrase = request.raw_post || request.query_string" does not allow me to test the search by entering an URL such as "/controller/search?ruby". query_string is not available to my search, it is emtpy.--3y #26319: "@phrase = request.raw_post || request.query_string" does not allow me to test the search by entering an URL such as "/controller/search?ruby" ...more...
|
P6.0
20-Oct-06
|
|
| 397 |
|
#24115: "If you want _to_ different actions depending on whether JavaScript is enabled..." --> "two"
|
P4.0
12-Feb-06
|
|
| 398 |
410 |
#24378: Under Web V2.1 heading: Need a comma after "(à l Google Suggest)".--Carol Deihl
|
P4.0
24-Mar-06
|
|
|
404 |
#23941: Fading out the random three elements does not work with the File 202 (update_many.rhtml) as downloaded. Nothing happens until you remove the comments that have been inserted at the top of that file. It seems the comments affect what is returned by the "eval(request.responseText)" call.
I am using Rails 1.0.0 and Ruby 1.8.2
--Mike Berrow #23941: Fading out the random three elements does not work with the File 202 (update_many.rhtml) as downloaded. Nothing happens until you remove the c ...more...
|
P1.0
12-Jan-06
|
|
|
415 |
#26459: OK this might just be my misunderstanding... but the @body hash is described as the vehicle for passing values to the template, however the example templates do not use the @body hash, but they use the order object directly. Is the @body hash superfluous in the examples?--Les Nightingill #26459: OK this might just be my misunderstanding... but the @body hash is described as the vehicle for passing values to the template, however the ex ...more...
|
P3.0
01-Nov-06
|
|
|
415 |
#24426: The section on E-mail templates calling partials is ok if the partial is in the same directory as the template. But what if the partial is in another view subdirectory. And what if that partial calls other partials and helper functions. Things break pretty fast.
Since "Rails can't guess the default locations", it seems like a good workaround is to use
email_body = render_to_string(:template=>"sometemplate")
in the regular controller with a regular template and then send that body to the email model with
email = create_sent(email_body) #24426: The section on E-mail templates calling partials is ok if the partial is in the same directory as the template. But what if the partial is in ...more...
|
P2.0
08-Apr-06
|
|
|
417 |
#24425: The section on Delivering HTML-Format E-mail is too brief. There needs to be a discussion of using a layout for the email and when and where the layout should be applied to the email. Also what about css files? Is it possible to use a css file with a Rails built HTML email? How to do it? Must give the full url not the url relative to the website base url. #24425: The section on Delivering HTML-Format E-mail is too brief. There needs to be a discussion of using a layout for the email and when and where ...more...
|
P2.0
08-Apr-06
|
|
|
425 |
#24156: The chapter on web services seems like notes. It would be better if there were a few more examples of less trivial situations. I'd like to see an example where some information is sent to a Rails app via web services to create a new instance of a model and then the model is saved. If the validations for the model fail then how can the errors and flash be sent back to the client app. #24156: The chapter on web services seems like notes. It would be better if there were a few more examples of less trivial situations. I'd like to see ...more...
|
P4.0
20-Feb-06
|
|
|
436 |
#24157: The two sections on external clients are confusing. Why are the endpoints listed in the XML-RPC section when they also apply to SOAP. I know there is a note about this but it is at the end of the XML-RPC section.
Also the section on SOAP says "and use an IDE... to generate the client class files." What?! This leaves me wondering a lot. Do I need to do this?
Perhaps for each section you could include the code for simple command line plain Ruby scripts for a SOAP client and a XML-RPC client that work with a previous Rails web service example. Please write this in a tutorial fashion (ie. step by step). #24157: The two sections on external clients are confusing. Why are the endpoints listed in the XML-RPC section when they also apply to SOAP. I know t ...more...
|
P4.0
20-Feb-06
|
|
|
437 |
#26390: "For delegated and layered dispatching, the information telling us which service object teh invocation should be routed to is embedded in the request. For delegated dispatching we rely on the controller action name to determine which service it should go to."
Shouldn't the first "delegated" be "direct"? --Alex Pounds <alex@alexpounds.com> #26390: "For delegated and layered dispatching, the information telling us which service object teh invocation should be routed to is embedded in the ...more...
|
P3.0
25-Oct-06
|
|
| 438 |
|
#23999: The "File Uploads" bookmark incorrectly points to the page previous to the actul "File Uploads" section.--Robert Stuttaford
|
P4.0
29-Jan-06
|
|
|
440 |
#24185: How do you quote SQL in the :order parameter? I tried :order => ["? ASC", order_by], but the ?s weren't expanded.--Justin Johnson
|
P2.0
23-Feb-06
|
|
| 451 |
|
#24240: Sorry, my fault I should have you reported this but when I saw it the first time. But I wasn't used to report bugs to the publisher directly.
----snip
def local_request?
["127.0.0.1", "88.88.888.101", "77.77.777.102"].include?(request.remo
----snap
You should subsitute 777 and 888 with a value <= 255.
--Markus Werner #24240: Sorry, my fault I should have you reported this but when I saw it the first time. But I wasn't used to report bugs to the publisher directly.
...more...
|
P4.0
06-Mar-06
|
|
|
457 |
#24275: For your next edition: Lighttpd is now available for Windows and configuration details for that platform would be very useful. I have tried to use the config provided, but cannot get Lighttpd to start. It fails to "find" the dispatch.fcgi file...
I had a hunch that the problem may be d/t the fact that the shebang line in dispatch.fcgi isn't used, so lighttpd doesn't know that it must pass the file to the ruby interpreter. However, changing the file extension to dispatch.fcgi.rb did not solve the problem so i remain in the dark. I know this isn't the appropriate forum for solving this problem for me, but perhaps you could off the top of your head give me some direction. Would be much appreciated.
Oh, and the book is great!!--Rainer Thiel #24275: For your next edition: Lighttpd is now available for Windows and configuration details for that platform would be very useful. I have tried to ...more...
|
P2.0
10-Mar-06
|
|
|
464 |
#25206: Found a solution to this on a message board (http://threebit.net/mail-archive/rails/msg00948.html). Seems the solution is to use ::ActionController::UnknownAction instead of ActionController::UnknownAction--ChrisT #25206: Found a solution to this on a message board (http://threebit.net/mail-archive/rails/msg00948.html). Seems the solution is to use ::ActionContr ...more...
|
P1.0
08-Jun-06
|
|
|
464 |
#23943: I don't know if this is a problem with Rails 1.0, Ruby 1.8.4, or something else entirely, but I could not get the rescue_action_in_public to load properly until I changed it. Ruby kept complaining that UnknownAction was an uninitialized constant. At first I just removed it, but that was unsatisfactory.
In the end I had to change the case to use exception.class.name rather than exception, and list string constants instead of the actual class literals. Doing that made it work.
I'm completely baffled about why this may be, but I'm a Ruby newbie as well as a Rails newcomer.--Jim Elliott #23943: I don't know if this is a problem with Rails 1.0, Ruby 1.8.4, or something else entirely, but I could not get the rescue_action_in_public to l ...more...
|
P3.0
13-Jan-06
|
|
|
464 |
#24247: I have the same error generated from page 464 of the P3.0 September printing - as Jim Elliot (#2298) suggests 'unitialized constant' "ActionUnknown" but I am obviously less astute than he as I haven't been able to figure out the adjustments that I must make to have it functional. Thus far, the RonR mail list has been unable to make it meaningful to me and so I am stuck with methodology suggested in the book that I can't make work.
Craig--Craig White #24247: I have the same error generated from page 464 of the P3.0 September printing - as Jim Elliot (#2298) suggests 'unitialized constant' "ActionUn ...more...
|
P4.0
07-Mar-06
|
|
|
474 |
#24525: "Creating the log files slows down the rendering of the action quite a lot on most machines"
Really? If so, perhaps you could talk about how to turn off / reduce logging.
OTOH, if you're actually referring to the tail command slowing things down, this sentence could be a lot clearer.
jon@steelskies.com--Jonathan del Strother #24525: "Creating the log files slows down the rendering of the action quite a lot on most machines"
Really? If so, perhaps you could talk about h ...more...
|
P4.0
25-Apr-06
|
|
| 477 |
|
#29343: animals = %w( ant bee cat dog elk )
should be...
animals = %w{ ant bee cat dog elk }--tim
|
P1.0
20-Jul-07
|
|
| 477 |
|
#24481: "put the start of the block at the end of the source line containing the method call."
This is ambiguous; what if I have a method call, a whole bunch of other stuff on the "source line", then a block? Could be written "put the start of the block after the method call, at the end of a line."--Mark Ostroth #24481: "put the start of the block at the end of the source line containing the method call."
This is ambiguous; what if I have a method call, a w ...more...
|
P4.0
13-Apr-06
|
|
|
487 |
#26707: "[...], sharing the modules functionality without using inheritance."
should be:
"[...], sharing the module's functionality without using inheritance."
--Gabor Cselle #26707: "[...], sharing the modules functionality without using inheritance."
should be:
"[...], sharing the module's functionality without us ...more...
|
P2.0
03-Dec-06
|
|
|
515 |
#24365: The following line drove me nuts...
<div class="seperator"> </div>
... as it kept on producing a questionmark(?) in the view. I thus removed the entity reference and used a normal space and still it produced the questionmark.
I finally revised the line and used the following to get the expected result:
<div class="separator"><%= sprintf("\ ") %></div>--Rheinard Korf #24365: The following line drove me nuts...
<div class="seperator"> </div>
... as it kept on producing a questionmark(?) in the view. I thus r ...more...
|
P3.0
23-Mar-06
|
|
| 517 |
|
#24433: Could the Index get its own entry in the outline view (Preview's 'drawer')? It always takes a couple brain cycles to remember to go to Appendices->Resources->Bibliography and then to the next page.--Rob Biedenharn #24433: Could the Index get its own entry in the outline view (Preview's 'drawer')? It always takes a couple brain cycles to remember to go to Append ...more...
|
P4.0
10-Apr-06
|
|
|
527 |
#24241: Page 527 (Appendix C.3 Cross-Reference of Code Samples):
Text states:
"If a source sample has a marginal note containing a number, you can look that number up in the list that follows to determine the file containing that code."
I downloaded the code for windows but some of it seems to be missing. For instance, the marginal note on page 87 mentions source sample File 82. The cross reference page 528 shows:
82 depot9/app/views/store/display_cart.rhtml
The problem is that there is no depot9 directory included in the code samples. There is a depot1, depot10, depot11, and depot12; but the display_cart.rhtml files in those directories do not match the source file as it is printed in the book(p.87 in the case of File 82 display_cart.rhtml).
Note the display_cart.rhtml in the depot10 directory is similiar to File 82, but not the same. This makes it a little frustrating to debug for typos when following along with the book.
Is there some way I can get the files as cross referenced from the book, rather than files that are merely just similar to the file I am looking for?--John #24241: Page 527 (Appendix C.3 Cross-Reference of Code Samples):
Text states:
"If a source sample has a marginal note containing a number, you can ...more...
|
P4.0
07-Mar-06
|
|
| 910faauyff |
8mx2hvufgn |
#30015: 5w69cgk6 xo5wz0aey wfj22eyi--7kkmix6ro3
|
P2.0
16-Dec-07
|
|
| PDF |
Paper |
Description |
Found in |
Fixed in |
|
ii |
#23826: Please put a list of Rails reserved words inside the front/back cover.
Maybe with a footnote to never use them as column headings in your tables.
I spent the last hour chasing down the error caused by using "method".
Anyway, thank you for a much better than average computer book.--John M Miller #23826: Please put a list of Rails reserved words inside the front/back cover.
Maybe with a footnote to never use them as column headings in your t ...more...
|
P1.0
09-Dec-05
|
|
|
1 |
#23512: For the next version a few plug-in examples would be nice
|
P2.0
03-Nov-05
|
|
| 6 |
|
#23137: Under "Rails Versions", both "Rails V1.0" and "Rails 1.0" are referred to. I think the "V" is unnecessary, so standardising on "Rails 1.0" would be best.
(Dave says: indeed it would...)--Tim Bell #23137: Under "Rails Versions", both "Rails V1.0" and "Rails 1.0" are referred to. I think the "V" is unnecessary, so standardising on "Rails 1.0" wou ...more...
|
P1.0
27-Jul-05
|
|
| 20 |
|
#23824: Linux Redhat FC4, doesn't install what you expect when you install ruby via YUM. To get a more complete ruby install type:
<code>yum -y install ruby rdoc irb</code>
otherwise you get strange errors when you install rails while it installs the rdocs.--Yan-Fa Li #23824: Linux Redhat FC4, doesn't install what you expect when you install ruby via YUM. To get a more complete ruby install type:
<code>yum -y in ...more...
|
P3.1
09-Dec-05
|
|
| 40 |
|
#24138: Re: Hashes and Parameter Lists
I'm new to Ruby, but have read page 474 on Arrays & Hashes - it made sense, apart form the last part on Hashes and Parameter Lists, which is a bit unclear.
Likewise, on page 40:
"The :action part is a Ruby symbol. You can think of the colon as meaning ... you can use this keyword parameter facility to give those parameters values."
??
I'd like to understand why hashes are being used for passing parameters.
Enjoying the book - thanks.--Anthony Denahy #24138: Re: Hashes and Parameter Lists
I'm new to Ruby, but have read page 474 on Arrays & Hashes - it made sense, apart form the last part on Hash ...more...
|
P4.0
16-Feb-06
|
|
| 51 |
|
#23882: Having the table definition using the equivalent Active Record Migrations definition would be nice. In this example I've substituted float for decimal in the definition since migrations does not have a corresponding type.
class CreateProductsTable < ActiveRecord::Migration
def self.up
create_table :products |table|
table.column :title, :string, :limit => 100
table.column :description, :text
table.column :image_url, :string, :limit => 200
table.column :price, :decimal
end
def self.down
drop_table :products
end
end
--Alan M #23882: Having the table definition using the equivalent Active Record Migrations definition would be nice. In this example I've substituted float fo ...more...
|
P4.0
26-Dec-05
|
|
| 52 |
|
#23825: For P53 to work on Fedora Linux FC4, it appears one has to install the mysql gem. Unfortunately that won't build unless you have previously installed ruby-devel and mysql-devel. And even then it won't build without passing extra parameters:
<code>
yum -y install ruby-devel mysql-devel
sudo gem install mysql -- --with-mysql-lib=/usr/lib/mysql
</code>
After you follow these steps, the basic admin app works.--Yan-Fa Li #23825: For P53 to work on Fedora Linux FC4, it appears one has to install the mysql gem. Unfortunately that won't build unless you have previously i ...more...
|
P3.1
09-Dec-05
|
|
|
53 |
#23818: Running OS X 10.4.3 and following all the directions in this chapter, I get to the place where I'm generating the scaffold and nothing works correctly. Others here have reported finding their proper directory at another location but whether I type http;//localhost:3000/admin or http://localhost:3000/products, I get the same error:
Routing Error
Recognition failed for "/products" (or "/admin")
I noticed that one response here was to get the latest Rails. I'm running 1.8.2 (2004-12-25) [powerpc-darwin8.0], which as far as I can tell is the latest released version of rails unless I'm just not understanding something. At least, I got this version by following the directions in the Pragmatic book, which to this point is the only source of information on which I'm relying.
I know my MySQL database is running and can be connected to. This appears sto be a problem of the generate script but I'm darned if I can figure out what should be going on here. I want to fall in love with Rails, but so far, she's jilting me!
--Dan Shafer #23818: Running OS X 10.4.3 and following all the directions in this chapter, I get to the place where I'm generating the scaffold and nothing works c ...more...
|
P3.0
05-Dec-05
|
|
| 53 |
|
#23842: On OSX Tiger (10.4.3) - Ruby 1.8.2 - Rails 1.0.0 - MySql 5.0
I was blocked using this command:
ruby script/generate scaffold Product Admin
blocks on line:
create test/fixtures/products.yml
To be fixed, user should install mysql gem using following command:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql--Alx #23842: On OSX Tiger (10.4.3) - Ruby 1.8.2 - Rails 1.0.0 - MySql 5.0
I was blocked using this command:
ruby script/generate scaffold Product Adm ...more...
|
P3.1
13-Dec-05
|
|
| 53 |
|
#23149: Regarding the /tmp/mysql.sock problem mentioned above. I had the same problem running on Fedora Core 4, there was no mysql.sock in /tmp.
I overcame the issue by using an IP address (127.0.0.1) in the database.yml file rather than localhost. You also need to alter the Mysql grant lines to use the IP address. This connects via TCP/IP rather than through /tmp/mysql.sock.
(Dave says: this must be some kind of mysl configuration thing. I'm not sure I can address it in the book, but the above is certainly good information to know)--Robert McGovern #23149: Regarding the /tmp/mysql.sock problem mentioned above. I had the same problem running on Fedora Core 4, there was no mysql.sock in /tmp.
I ...more...
|
P1.0
31-Jul-05
|
|
| 53 |
|
#23479: This is a follow-up to my post of earlier this morning.
I don't know whether it's definitive, but I've found a solution that works for me: http://www.pjhyett.com/articles/2005/06/04/setting-up-ror-in-tiger.
I'm glad to have found this, but it took uncomfortably much digging, so I hope you'll add a pointer to this site in the next release of the book, if the problems haven't been fixed (by Apple and anyone else at fault) by then.--Ralph Haygood (rhaygood@duke.edu) #23479: This is a follow-up to my post of earlier this morning.
I don't know whether it's definitive, but I've found a solution that works for me: ...more...
|
P3.0
26-Oct-05
|
|
| 53 |
|
#23251: On Mac OS X I was getting the error "Access denied for user --Lyle Vogtmann
|
P2.0
16-Sep-05
|
|
| 53 |
|
#23795: This not so much a new erratum as a request that erratum #1073 on page 53 of the PDF file be explained in more detail than it currently appears. This is the "Access denied for user ��@�localhost� (using password: NO)" problem on OSX 10.4. Please explain where the file to be patched resides, how to recompile it - which version of gcc - and anything else that needs to be done. I've been trying to generate a scaffold for three weeks now and researching the issue on the web I've found a lot of other people who are running in circle like me: we could really benefit from a more detailed and comprehensive tutorial on how to get RoR to play nice with MySQL on OSX 10.4+--Stefano Bertolo #23795: This not so much a new erratum as a request that erratum #1073 on page 53 of the PDF file be explained in more detail than it currently appear ...more...
|
P3.0
27-Nov-05
|
|
|
54 |
#23459: Now that MySql 5.0 is "generally available", novices to MySQL may encounter an ERROR 42000: Can't find any matching row in the user table. This is because GRANTs to a non-existant user no longer create that user(http://bugs.mysql.com/bug.php?id=7000)
Future versions should probably demonstrate how to create the databases using GRANTS for version prior to 5.0.2 and using the CREATE USER statement (http://dev.mysql.com/doc/refman/5.0/en/create-user.html) for MySQL 5.0.2 and later. (Confirm that 5.0.2 was when GRANT changed to no longer adding users if they did not exist).--David Willis #23459: Now that MySql 5.0 is "generally available", novices to MySQL may encounter an ERROR 42000: Can't find any matching row in the user table. Th ...more...
|
P2.0
25-Oct-05
|
|
| 62 |
|
#23111: The suggested image url is relative /images/sk_auto_small.jpg but the validation requires a full url starting with http.
(Dave says: I'm going to tidy all that up in the next edition: it was a change made at the suggestion of a reviewer, but in retrospect I regret it) #23111: The suggested image url is relative /images/sk_auto_small.jpg but the validation requires a full url starting with http.
(Dave says: I'm g ...more...
|
P1.0
17-Jul-05
|
|
|
64 |
#23540: This is the first mention of validation that I saw in the book. I'm experimenting with a database containing constraints and the question that came to mind immediately was "Does/can Rails validation work with the database's constraints?" I'm not sure an in-depth explanation is appropriate this early in the book, but at least a one-liner similar to "See page whatever for information on the relationship between constraints and validation" --Brian #23540: This is the first mention of validation that I saw in the book. I'm experimenting with a database containing constraints and the question tha ...more...
|
P2.0
10-Nov-05
|
|
| 67 |
|
#23892: The hyperlink to click back to page 56 goes to page 54. The reference to material on page 56 is correct, just the location the link moves you to is incorrect.--Alan M #23892: The hyperlink to click back to page 56 goes to page 54. The reference to material on page 56 is correct, just the location the link moves you ...more...
|
P4.0
30-Dec-05
|
|
|
68 |
#24112: Another problem with web development is keeping HTML formating separated from its content. (The idealization of this concept is the 'semantic web'.) It's easy today to separate content from formatting using CSS. Most modern browsers support CSS1 and CSS2, and the CSS3 standard is around the corner. The use of CSS is an overdue concept that I would expect a book on new technologies such as this one would promote.
I am disappointed to see that the list.rhtml example on page 68 shows formatting attributes placed inline with the HTML. The attributes "cellpadding", "cellspacing", "width", "height", etc. have their CSS equivalents and could as easily been placed in the scaffold.css file. Doing so would be an added benefit for the readers of your book and for the future of the web.
I hope this gets corrected in future copies. I want to believe that such a timely and otherwise well written book is promoting *all* of the modern standards.
Thank you,
Jose Hales-Garcia
UCLA Department of Statistics
--Jose Hales-Garcia #24112: Another problem with web development is keeping HTML formating separated from its content. (The idealization of this concept is the 'semantic ...more...
|
P4.0
11-Feb-06
|
|
|
75 |
#23880: In task A, class names in HTML are in CamelCase, like ListLine, ListTitle (p. 69).
In task B, class names in HTML are in lower case, like catalogentry, catalogprice (p. 75)
It would be better to stick to one style.--olegf #23880: In task A, class names in HTML are in CamelCase, like ListLine, ListTitle (p. 69).
In task B, class names in HTML are in lower case, like cat ...more...
|
P2.0
24-Dec-05
|
|
| 76 |
|
#23902: The equivalent Active Record Migrations definition of line_items table:
class CreateLineItemsTable < ActiveRecord::Migration
def self.up
create_table :line_items do |table|
table.column :product_id, :integer, :null => false
table.column :quantity, :integer, :default => 0, :null => false
table.column :unit_price, :decimal, :null => false
end
execute "ALTER TABLE line_items ADD CONSTRAINT fk_items_product FOREIGN KEY (product_id) REFERENCES products (id)"
end
def self.down
drop_table :line_items
end
end--Alan M #23902: The equivalent Active Record Migrations definition of line_items table:
class CreateLineItemsTable < ActiveRecord::Migration
def self.up ...more...
|
P4.0
31-Dec-05
|
|
| 77 |
|
#23895: Since mysql 4.0, InnoDB has become the default storage engine, and it supports foreign key. This seems to make footnote 1 on this page unnecessary.
--Haobo Yu
|
P4.0
31-Dec-05
|
|
|
96 |
#23394: in the action add_to_cart we have a rescue that states in the logger.error "Attempt to access invalid product #{params[:id]}"
...thats not neccessarily true in my case the error occured somewhere in the find_card so it got me totaly confused.
Shouldn't the rescue be limited to "product = Product.find(params[:id])" excluding the next two lines?
Something like:
def add_to_cart
begin
product = Product.find(params[:id])
rescue
logger.error("Attempt to access invalid product #{params[:id]}")
flash[:notice] = 'Invalid product'
redirect_to(:action => 'index')
return
end
@cart = find_cart
@cart.add_product(product)
redirect_to(:action => 'display_cart')
end--Nicolas Holzheu #23394: in the action add_to_cart we have a rescue that states in the logger.error "Attempt to access invalid product #{params[:id]}"
...thats not ne ...more...
|
P2.0
18-Oct-05
|
|
|
108 |
#23907: Using <%= error_messages_for( :order ) %> in book while the files contain <%= error_messages_for( "order" ) %>--Jon Smirl
|
P3.0
02-Jan-06
|
|
|
122 |
#23847: It looks like the pluralize method added to the controller is designed to provide you feedback even if you've checked no items to ship (the when 0 case formats it nicely). However, this will never get displayed, because flash.now is set only if count > 0 up in the ship method. Getting rid of the if clause around the setting of flash.now fixes this, and you get notified if you hit the ship button with nothing checked. I suspect this was the original intent; I certainly like it better that way.
Also note that this change doesn't cause a spurious notice to appear when you first reach the shipping page; that's prevented by the outer if statement in which things_to_ship is assigned.--Jim Elliott #23847: It looks like the pluralize method added to the controller is designed to provide you feedback even if you've checked no items to ship (the wh ...more...
|
P3.0
14-Dec-05
|
|
| 122 |
129 |
#23180: See the last paragraph before the screenshot. Starts with the text "That--Tom Brice
|
P2.0
19-Aug-05
|
|
| 126 |
|
#23074: The sentence that begins "If you are following along, delete your session file..." refers ,I believe, to a technique discussed in footnote 5 on page 84. The footnote does not use the term "session file"; it calls it a "cookie file". The technique is much better specified for Unix than it is for Windows. This technique should be discussed in more detail, either here or on page 84. --Michael Cronin #23074: The sentence that begins "If you are following along, delete your session file..." refers ,I believe, to a technique discussed in footnote 5 o ...more...
|
B1.0
08-Jul-05
|
|
| 134 |
|
#23893: Not sure if this is a difference between Rails versions, but in the test_truth method of ProductTest, the book reads "assert_kind_of Product, @product" whereas my autogenerated code was "assert_kind_of Product, products(:first)" Thought it should be noted for other readers. --Mike #23893: Not sure if this is a difference between Rails versions, but in the test_truth method of ProductTest, the book reads "assert_kind_of Product, ...more...
|
P4.0
30-Dec-05
|
|
|
138 |
#23276: The code on page 138 of the book is incorrect
redirect_to(jumpto) will not work if jumpto contains nested hashes. For example, if jumpto contains this post hash, it will not work.
{"commit"=>"ask", "post"=>{"title"=>"asdfsdfs", "body"=>"asdfsdf", "price"=>"345", "tags"=>"#finance ", "email"=>"myemail@gmail.com"}, "action"=>"postQ", "controller"=>"ask"}
will result in request_to flattening it down to
{"commit"=>"ask", "post"=>"titleasdfsdfsbodyasdfsdfprice345tags#finance emailmyemail@gmail.com", "action"=>"postQ", "controller"=>"ask"}--Baldukai and Defiler #23276: The code on page 138 of the book is incorrect
redirect_to(jumpto) will not work if jumpto contains nested hashes. For example, if jumpto co ...more...
|
P1.0
05-Oct-05
|
|
| 140 |
|
#23868: In Rails 1.0 the defaults behaviour for fixtures in tests changed. If you use MySQL without transactions (as you will if you follow the book), the fixtures are not restored after every test method.
As a fix you can either use InnoDB tables (that have transactions) or set the config value use_transactional_fixtures=false and use_instantiated_fixtures=true in test/test_helper.rb. Then you have the pre-1.0 behaviour.
(Dave says: yes, we'll be redoing this in the next edition)
--Felix von Delius #23868: In Rails 1.0 the defaults behaviour for fixtures in tests changed. If you use MySQL without transactions (as you will if you follow the book), ...more...
|
P3.1
20-Dec-05
|
|
| 140 |
|
#23798: "Here�s the bottom line: even if a test method updates the test database,
the database is put back to its default state before the next test method is
run. This is important because we don�t want tests to become dependent
on the results of previous tests."
I am having trouble with this... I moved the test_destroy method above the test_update method, and the test_update method fails because it can't find a product with id=1. The database table doesn't seem to be restored between tests.
(This is probably due to a change in the Rails defaults since the book was written. We'll make all this clearer in the next edition) #23798: "Here�s the bottom line: even if a test method updates the test database,
the database is put back to its default state before the next test ...more...
|
P3.0
28-Nov-05
|
|
|
146 |
#23843: Further to Mark's suggestion it is probably better to update the test/test_helper.rb file, which is where these values are explicitly set.--Chris Sendall
|
P2.0
14-Dec-05
|
|
| 149 |
146 |
#23789: When you start calling the test_delete and test_read_with_hash methods the code breaks. In order for the code to work you have to put the following lines at the top of your unit test:
self.use_transactional_fixtures = false
self.use_instantiated_fixtures = true
(Agreed--this is a change in Rails since the book was written)--Mark Bates #23789: When you start calling the test_delete and test_read_with_hash methods the code breaks. In order for the code to work you have to put the foll ...more...
|
P3.0
24-Nov-05
|
|
| 150 |
157 |
#23858: I was having problems getting the tests described in chapter 12 to work. Specifically, once i deleted a piece of test data (test_destroy), that piece if data (the first book) wasn't present again for subsequent tests. I believe the problem is that MySQL was defaulting to MyISAM format for my tables. MyISAM doesn't support transaction rollback. It appears the way that the test harness ensures test data is in it's original form for each test is to use a transaction ROLLBACK which is ignored by MySQL for tables using MyISAM format.
In order to fix this, I went into my create.sql script and added TYPE = InnoDB to the end of each table create.
That causes MySQL to enforce transactions and the unit tests began to work as described in the text.
Here is an example of the exact create table syntax:
create table products (
id int not null auto_increment,
...other columns...
primary key(id)
) TYPE=InnoDB;
(Dave says: this is a change to the default Rails behaviour since the book was written.--Steven Chanin #23858: I was having problems getting the tests described in chapter 12 to work. Specifically, once i deleted a piece of test data (test_destroy), th ...more...
|
P3.1
18-Dec-05
|
|
|
151 |
#23577: I agree with Richard Jensen's comment, the paragraph beginning "While the use of time is a convenient way of demonstrating a dynamic fixture..." is confused:
1) It would seem that Mike would need to pass in a *past* date (rather than future date) to test his revised salable_items().
2) While I believe Mike's general statement that unit tests can provide insights on how to better refactor the code, in this specific case, I don't see it. Adding a date parameter to salable_items() is gratuitous as far as the application itself is concerned. Are we really going to ask (from the application) "which items are salable tomorrow (or yesterday)?" If so, then yeah, we need the date parameter. Otherwise, I'd argue that it's not worth increasing the application's complexity/potential sources of error just to make testing it trivially easier.
...But (like Richard) I wonder if I'm missing Mike's point...--Frank Myhr #23577: I agree with Richard Jensen's comment, the paragraph beginning "While the use of time is a convenient way of demonstrating a dynamic fixture.. ...more...
|
P2.0
20-Nov-05
|
|
|
173 |
#23264: I run 'rake test_units' as instructed and get an error because the line_item_tests (which we haven't modified) fail. This appears to be due to a foreign key constraint triggered by the line_items fixture.
1) Error:
test_truth(LineItemTest):
ActiveRecord::StatementInvalid: #23000Cannot add or update a child row: a foreign key constraint fails: INSERT INTO line_items (`id`) VALUES (2)
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.11.1/lib/active_record/connect
ion_adapters/abstract_adapter.rb:462:in `log'
(Dave says: we're going to rewrite this chapter to use transactional fixtures and work out these kinds of issues)--Richard Jensen #23264: I run 'rake test_units' as instructed and get an error because the line_item_tests (which we haven't modified) fail. This appears to be due to ...more...
|
P1.0
28-Sep-05
|
|
|
176 |
#23265: The performance test doesn't run.
1) Error:
test_save_bulk_orders(OrderTest):
ActiveRecord::StatementInvalid: #23000Cannot delete or update a parent row: a foreign key constraint fails: DELETE FROM orders
If I add "LineItem.delete_all" in the teardown before the Order.delete_all, it seems to work.
--Richard Jensen #23265: The performance test doesn't run.
1) Error:
test_save_bulk_orders(OrderTest):
ActiveRecord::StatementInvalid: #23000Cannot delete or u ...more...
|
P1.0
28-Sep-05
|
|
| 185 |
|
#23865: "See the Active Support RDoc for details." If it has been mentioned anywhere how to do this, I missed it, and so did s search of the PDF for RDoc. Generating documentation for your own app was mentioned, though the lack of detail on that was rather disappointing to me.--UltraBob #23865: "See the Active Support RDoc for details." If it has been mentioned anywhere how to do this, I missed it, and so did s search of the PDF for R ...more...
|
P3.1
20-Dec-05
|
|
| 191 |
|
#23874: In Rails 1.0, the Inflector class correctly handles "sheep", so the example that reads " if you have a class named Sheep, it’ll valiantly try to find a table named sheeps" is no longer true. Try "deer", although that word will get fixed soon, too.--Tim Cartwright #23874: In Rails 1.0, the Inflector class correctly handles "sheep", so the example that reads " if you have a class named Sheep, it’ll valiantly try ...more...
|
P3.1
22-Dec-05
|
|
| 216 |
|
#23867: Could you add sub-sections in Database relationship (or in large chapters in general) so it'll be easier to navigate to a specific sub-chapter in the index view (in Apple Viewer for example).
Thanks for this one great book.--Alx #23867: Could you add sub-sections in Database relationship (or in large chapters in general) so it'll be easier to navigate to a specific sub-chapter ...more...
|
P3.1
20-Dec-05
|
|
|
259 |
#23575: Love the book, it's somewhat warn now!
It would be great if you could include end to end examples of Localization; example: SQL date in the DB, display, edit UK style date.
Secondly, and more important, end to end use of composed_of - again show and update of a composed_of field using rhtml
Many thanks--Jonathan #23575: Love the book, it's somewhat warn now!
It would be great if you could include end to end examples of Localization; example: SQL date in the ...more...
|
P2.0
20-Nov-05
|
|
| 300 |
|
#23963: Minor! "Cookies and Sessions" in the PDF's table of contents points to the bottom of page 300. The section actually begins at the top of page 301.--Grant Hollingworth
|
P4.0
17-Jan-06
|
|
| 328 |
|
#23548: Discussion of templates leaves out the rules for comments. I went nuts for two days trying to find the syntax error when
my html comment was perfectly fine, surrounding the erb delimiters. That doesn't work and it seems like a bug. The ruby manual mentions putting the hash mark after the percent-sign in the beginning and that works.
The rails book leaves that out.
--Warren Seltzer/Michael Nacht #23548: Discussion of templates leaves out the rules for comments. I went nuts for two days trying to find the syntax error when
my html comment was ...more...
|
P3.0
12-Nov-05
|
|
| 352 |
|
#23130: It would be nice to see a discussion of file uploading that doesn't insert the file into the database in a future version of the book.
|
P1.0
23-Jul-05
|
|
| 387 |
399 |
#23165: The code described as "File 194" has "<% 16.times do |i| ..." which I think is trying to build a 4x4 series of squares, but the diagram on the following page (Figure 18.7)have only a 3x3. Should the "16.times" be "9.times"?
(Dave says: hmmm.... actually, the code in the book is what produced the window shown. I just sized the browser window to produce the list of 9 squares. That's kinda confusing, I agree, but isn't really an error. I'll fix this in the next edition)--Alan Hynes #23165: The code described as "File 194" has "<% 16.times do |i| ..." which I think is trying to build a 4x4 series of squares, but the diagram on the ...more...
|
P1.0
07-Aug-05
|
|
| 401 |
|
#22935: Could you guys consider squeezing in some more information about Unicode? It is true that Ruby's support for Unicode is not as mature as, say, Python's, but that doesn't mean that it's not possible to create fully multilingual apps in Rails. After writing a couple blog posts on the subject ([1]), (only to find out later that [3] had all that information and more), it seems clear to me that it *is* possible to write apps that handle multilingual text without too much trouble, even if Ruby can't handle manipulating individual characters too easily.
i18n is a pretty important topic these days, and I for one would love to see the cutting edge of Rails extend to that domain...
Cheers,
Patrick Hall
[1] http://tinyurl.com/d9bns
[2] http://manuals.rubyonrails.com/read/chapter/82
(Dave says: this is definitely important, but it won't make the first printing of the book. I'm going to leave this ticket open and revisit it later)--Patrick Hall #22935: Could you guys consider squeezing in some more information about Unicode? It is true that Ruby's support for Unicode is not as mature as, say, ...more...
|
B2.0
26-Jun-05
|
|
|
551 |
#23569: It would be nice if the RecordNotFound exception was included in the index, as the RecordInvalid exception is. The index entry could refer to the "Reading Existing Rows" section on page 212 and also the "To Raise, or Not to Raise?" sidebar on page 219. In the absence of an entry for RecordNotFound, I used the index entry for the find() method, which references page 212 but not page 219.--Stephen Viles #23569: It would be nice if the RecordNotFound exception was included in the index, as the RecordInvalid exception is. The index entry could refer to ...more...
|
P1.0
18-Nov-05
|
|
|
551 |
#23570: New index entry for RecordNotFound exception could also reference the "Iteration C2: Handling Errors" section starting on page 91.--Stephen Viles
|
P1.0
18-Nov-05
|
|