I am trying to do the following:
validates :price, :presence => true, :if => Proc.new {|p| p.available == true}
validates :price, :presence => false, :if => Proc.new {|p| p.available == false}
So that if the boolean :available is true, :price must be present, and if it is false, :price must be nil.
But when I test this in the console it doesnt work. Any idea about what am I might be doing wrong?
Yeah, I’m not sure you can stack validations now. However, you may be able to do what you want from a before_validation.