Das Oracle
July 5th, 2007, 03:38 AM
Here's my code:
class Classified < ActiveRecord::Base
belongs_to :category
validates_presence_of :title,
:message => "cannot be blank. Make your title descriptive"
validates_presence_of :price
validates_numericality_of :price,
:message => "must be a numeric value (no $ signs or decimals)"
validates_presence_of :location
validates_presence_of :description
validates_presence_of :email
protected
def validate
errors.add(:price, "should be a positive value") if price.nil?
|| price <= 0
end
validates_format_of :email,
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
end
and the error i get from such code is found at this site: vesoautomotive.dyndns.org:3000
the site is just a dyndns link to my apache server so please don't think to be spam.
specifically the error I am getting involves this line of code:
def validate
errors.add(:price, "should be a positive value") if price.nil?
|| price <= 0
end
class Classified < ActiveRecord::Base
belongs_to :category
validates_presence_of :title,
:message => "cannot be blank. Make your title descriptive"
validates_presence_of :price
validates_numericality_of :price,
:message => "must be a numeric value (no $ signs or decimals)"
validates_presence_of :location
validates_presence_of :description
validates_presence_of :email
protected
def validate
errors.add(:price, "should be a positive value") if price.nil?
|| price <= 0
end
validates_format_of :email,
:with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i
end
and the error i get from such code is found at this site: vesoautomotive.dyndns.org:3000
the site is just a dyndns link to my apache server so please don't think to be spam.
specifically the error I am getting involves this line of code:
def validate
errors.add(:price, "should be a positive value") if price.nil?
|| price <= 0
end