Sha256: 751932649e40ec7622f7531a342ac8b4e07ec5bafe65c3bf5fa1a11e073694dc

Contents?: true

Size: 284 Bytes

Versions: 11

Compression:

Stored size: 284 Bytes

Contents

class PlanIdPatternValidator < ActiveModel::EachValidator  
  def validate_each record, attribute, value
    if value.nil? || !value.match(/^(([\w\-]{0,62})?)$/i)
      record.errors[attribute] << "accepts alphanumeric characters, '-', and '_' only. no spaces"  
    end  
  end  
end

Version data entries

11 entries across 11 versions & 1 rubygems

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