Let’s say I have a model, Post.rb:
validates :title => true
validates :post => true, :length => { :maximum => 220 }
validate :custom_validation
def custom_validation
...
end
I want to run the validtions for title, post, and the custom_validation ONLY if another attribute, draft, is false. (ie ignore when draft is true).
How can I do this?
1 Answer