small medium large xlarge

19 Mar 2008, 18:25
Tim Wolak (1 post)

I am working on the depot store and on page 85 after you enter in the code for checking the title uniqueness my code fails with udefined method ‘title’. Has anyone seen this before?


class Product < ActiveRecord::Base validates_presence_of :title, :description, :image_url validates_numericality_of :price validates_uniqueness_of :title validates_format_of :image_url, :with => %r{.(gif|jpg|png)$}i, :message => “must be a URL for a GIF, JPG or PNG image” protected def validate errors.add(:price, “should be at least 0.01”) if price.nil? || price < 0.01 end end

21 May 2008, 20:34
David Kiely (2 posts)

I was seeing undefined method `title’ when I accessed the page products/new It was raised by products/new.html.erb on line #8 I have been following the 3rd edition of AWDWR and have noticed many differences between the book and what happens in the code. The problem here was that title wasn’t a column in my database.

so I would check my tables and check the spelling again.

You must be logged in to comment