Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Invoice < ActiveRecord::Base
- validate :expiration_date_cannot_be_in_the_past,
- :discount_cannot_be_greater_than_total_value
- def expiration_date_cannot_be_in_the_past
- if expiration_date.present? && expiration_date < Date.today
- errors.add(:expiration_date, "can't be in the past")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement