Sha256: edd850f0659e83b48b6dc9db733f89cc975d986064babecfc946a1a05d7ae7bb

Contents?: true

Size: 417 Bytes

Versions: 14

Compression:

Stored size: 417 Bytes

Contents

class MyValidator < ActiveModel::Validator
  def validate(record)
    [:dob, :joined].each do |date_field|
      if record.__send__(date_field).nil?
        record.errors[date_field] << "Can't be blank"
      end
    end
  end
end




class OverrideErrorClashEmployee < Employee

  validates_with MyValidator

  acts_as_gov_uk_date :dob, :joined, error_clash_behaviour: :override_with_gov_uk_date_field_error



end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gov_uk_date_fields-3.2.0.rc2 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-3.2.0.rc1 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-4.1.0 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-4.0.1 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-4.0.0 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-3.1.0 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-3.0.0 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-2.2.0 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-2.1.1 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-2.1.0 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-2.0.3 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-2.0.2 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-1.2.3 test/dummy/app/models/override_error_clash_employee.rb
gov_uk_date_fields-1.2.2 test/dummy/app/models/override_error_clash_employee.rb