Tuesday, 17 March 2015

validates_each

validates_each :date_expire, on: :create, if: ->(r) { r.is_company? } do |record, attr, value|
record.errors.add attr, 'must be in the future ' if value < Date.today
end
view raw gistfile1.rb hosted with ❤ by GitHub

No comments:

Post a Comment