class Humpyard::ActiveModel::PublishRangeValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/humpyard/active_model/validators/publish_range.rb 4 def validate_each(record, attribute, value) 5 if attribute == :display_from and not record.display_from.blank? and not record.display_until.blank? and record.display_until < record.display_from 6 record.errors.add attribute, :cannot_be_after_display_until 7 end 8 if attribute == :display_until and not record.display_until.blank? and not record.display_from.blank? and record.display_until <= record.display_from 9 record.errors.add attribute, :cannot_be_before_display_from 10 end 11 end