Sha256: d93448fd7da9449d4e7298a16c938bbcd1f6688d2bcab8ed48e6eb7f6e6729cc

Contents?: true

Size: 327 Bytes

Versions: 11

Compression:

Stored size: 327 Bytes

Contents

class LegalNamePatternValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    if value.nil? || !value.match(/\A\S+?\s\S+?(?:\s\S+?)?\Z/i)
      record.errors[attribute] << "must be in the form \"First Last\", \"First Middle Last\", or \"First M Last\" (no prefixes or suffixes)"
		end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
stripe_local-0.2.5 app/validators/legal_name_pattern_validator.rb
stripe_local-0.2.4 app/validators/legal_name_pattern_validator.rb
stripe_local-0.2.3 app/validators/legal_name_pattern_validator.rb
stripe_local-0.2.2 app/validators/legal_name_pattern_validator.rb
stripe_local-0.2.1 app/validators/legal_name_pattern_validator.rb
stripe_local-0.2.0 app/validators/legal_name_pattern_validator.rb
stripe_local-0.1.3 app/validators/legal_name_pattern_validator.rb
stripe_local-0.1.2 app/validators/legal_name_pattern_validator.rb
stripe_local-0.1.1 app/validators/legal_name_pattern_validator.rb
stripe_local-0.1.0 app/validators/legal_name_pattern_validator.rb
stripe_local-0.0.2 app/validators/legal_name_pattern_validator.rb