Hello, I just got hold of the book ‘Agile Web D. with Rails’
and I have been following along.
I just went through a segment of trying to add validation to a form.
I added the following code, as instructed, to my app/models/Products.rb
file:
protected
def validate
errors.add(:Price, “should be positive”) unless Price.nil? || Price
= 0.01
end
with the exception of the upper-case P on Price, this is letter for
letter (unless I just can’t read today).
When I try and submit the form I get this error.
NameError in Admin#create
uninitialized constant Price
Can’ figure this out at all. I’ve been following the tutorial to the
letter and I’m sure if they had had this problem it would have been
mentioned. Anyone have any ideas? I’m using the latest release of RoR,
Mac OSX and MySQL 4.1
Thanks