Sha256: ddcad64fb8fe4ce639b3adcb745a5c62d2ad27b0ae37ccfca0a7725f7b227200

Contents?: true

Size: 269 Bytes

Versions: 11

Compression:

Stored size: 269 Bytes

Contents

class FullNamePatternValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    if value.nil? || !value.squeeze(" ").strip.match(/\A\S+?\s\S+?\Z/i)
      record.errors[attribute] << "First & Last names separated by a space"
		end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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