Hi there
how do I make validates_presence_of and validates each work?
here is my code
I forgot to mention
I saw the :allow_nil option in the api docs but I dont know how to use it
in my case
You could add an if statement to the top of your validates_each block as
such to emulate what validates_presence_of does eg:
validates_each :quantity do |model, attr, value|
if value.blank?
model.errors.add(attr, "can't be blank")
elsif value < User.find(:first, :conditions => ['id = ?',
record.user_id]).minimumbottles
...
end
end