Sha256: 8c6634bc631d3d40f9a5fb492f4dc91707ba3338a7ac46fec4f15922bcf1efcd

Contents?: true

Size: 360 Bytes

Versions: 3

Compression:

Stored size: 360 Bytes

Contents

class RoutingNumberValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    record_error(record, attribute, value) unless BankValidator::RoutingNumber.new(value).valid?
  end
  
  private
  
  def record_error(record, attribute, value)
    record.errors.add(attribute, (options[:message] || :invalid_routing_number))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bank-validator-0.3.2 lib/active_model/routing_number_validator.rb
bank-validator-0.3.1 lib/active_model/routing_number_validator.rb
bank-validator-0.3.0 lib/active_model/routing_number_validator.rb