Apr 30, 2008
Generic-user-small Bruce C. Mar... 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / State of the beta?

Let me second that comment, Thank you for your time and effort.

 
Apr 30, 2008
Generic-user-small Bruce C. Mar... 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Depot application "Admin"

Teaches me to skip the preface and jump right in. Thanks Sam you guys rock, I have been spreading the word about the book to all I know.

Bruce

 
Apr 30, 2008
Generic-user-small Bruce C. Mar... 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Validating image URL

That’s it for some reason my mind looked right over the comma. It’s in the text plain as day. Thanks.

Bruce

 
Apr 29, 2008
Generic-user-small Bruce C. Mar... 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Depot application "Admin"

I noticed in the third edition that when loading the depot application the example still shows http:\\localhost:3000/admin. Unlike second edition I don’t see where we create the admin controller. When trying to display the page using http:\\localhost:3000/admin a “Page cannot be displayed” message is delivered. I find that buy calling http:\\localhost:3000/products the page does display correctly. Is this the correct method or is there a step that I missed in the tutorial.

Bruce

 
Apr 29, 2008
Generic-user-small Bruce C. Mar... 5 posts

Topic: Agile Web Development with Rails, 3rd Edition / Validating image URL

I have just started working with AWDR and have the beta of the third edition. I have run into a problem when trying to validate the image url. Here is what I have in the product.rb file, excluding the begining and ending quotes.

class Product < ActiveRecord::Base 
  validates_presence_of :title, :description, :image_url
  validates_numericality_of :price
  validate :price_must_be_at_least_a_cent
  validates_uniqueness_of :title
  validates_format_of :image_url
                      :with => %r{.(gif|jpg|png)$}i,
                      :message => "must be a URL for GIF, JPG or PNG image.(gif/jpg/png)" 

protected
  def price_must_be_at_least_a_cent
    errors.add(:price, 'should be at least 0.01')if price.nil? || price < 0.01    
  end
end

but I end up with the follow error when I refresh the page.

C:/Ruby_Test/depot/app/models/product.rb:7: syntax error, unexpected tASSOC, expecting kEND :with => %r{.(gif|jpg|png)$}i, ^
C:/Ruby_Test/depot/app/models/product.rb:7: syntax error, unexpected ’,’, expecting kEND

did I miss something in the book?

Bruce

5 posts