Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Open Source > BOOK: Beginning Ruby on Rails
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Ruby on Rails
This is the forum to discuss the Wrox book Beginning Ruby on Rails by Steve Holzner Ph.D.; ISBN: 9780470069158
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Ruby on Rails section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 16th, 2007, 07:14 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default ch 8 "validate against inclusion in a list"

On p, 235 of "Beginning Ruby on Rails" the "Validating against Inclusion in a List" Try It Out example is not working for me. I created the database and table correctly and even deleted and recreated them to be sure. I also properly edited and saved the field.rb file according to the book's instructions as well as the _form.rhtml file. When I start the WEBrick Server and access http://localhost:3000/manage I am able to click on the link to go to the view to add a new field, but no matter what number I enter whether it is within the 1 to 99 range or not, I receive the error that "data is out of bounds" which I should only receive if I enter a number less than 1 or greater than 99. Any assistance in getting this to work would be great. Thanks.
  #2 (permalink)  
Old January 16th, 2007, 07:29 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The following example "validates_exclusion_of" doesn't work either. Instead of not allowing anything like the previous example, it allows anything and doesn't exclude any numbers.
  #3 (permalink)  
Old February 13th, 2007, 11:42 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The author already detected this error p235
(see the errata before posting, if you can).

The problem is that you try to compare a string input with a numeric.
Your should write '1'..'99', not 1..99, in the test.

Cheers !


  #4 (permalink)  
Old February 13th, 2007, 12:47 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Demitton, thanks. I was the one who pointed out that error and they added it after. The other way to fix the problem is to change the type that the database record expects. Then you can use integers instead of strings.
  #5 (permalink)  
Old June 28th, 2010, 09:07 PM
Registered User
 
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Neither the book code nor the errata code works. The errata code never detects an error (using InstantRails 1.7 so there are no version issues). Any suggestions?
  #6 (permalink)  
Old July 20th, 2010, 07:02 PM
Registered User
 
Join Date: Jun 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What works in Instant Rails 1.7 is

"1..99"

The '1'..'99' listed above does not work.
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
conditional inclusion of a namespace suman9730 General .NET 1 September 6th, 2006 03:19 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
List tablesname from database & list databasename ittorget MySQL 3 September 10th, 2005 03:06 AM
Ch. 4 & Ch. 12 athena BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 23rd, 2004 10:54 AM



All times are GMT -4. The time now is 08:02 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.