Sha256: 4e0f217648b1497a6df10e31536d88a96f132e55e8d66a0729f37998f915a889

Contents?: true

Size: 430 Bytes

Versions: 26

Compression:

Stored size: 430 Bytes

Contents

module Spree
  module NumberIdentifier
    extend ActiveSupport::Concern

    included do
      before_validation :uppercase_number

      validates :number, presence: true, length: { maximum: 32, allow_blank: true },
                         uniqueness: { allow_blank: true, case_sensitive: true, scope: spree_base_uniqueness_scope }
    end

    protected

    def uppercase_number
      number&.to_s&.upcase!
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/concerns/spree/number_identifier.rb
spree_core-4.10.0 app/models/concerns/spree/number_identifier.rb
spree_core-4.9.0 app/models/concerns/spree/number_identifier.rb
spree_core-4.8.3 app/models/concerns/spree/number_identifier.rb
spree_core-4.8.2 app/models/concerns/spree/number_identifier.rb
spree_core-4.7.3 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.6 app/models/concerns/spree/number_identifier.rb
spree_core-4.5.5 app/models/concerns/spree/number_identifier.rb
spree_core-4.4.1 app/models/concerns/spree/number_identifier.rb
spree_core-4.5.4 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.5 app/models/concerns/spree/number_identifier.rb
spree_core-4.7.2 app/models/concerns/spree/number_identifier.rb
spree_core-4.7.1 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.4 app/models/concerns/spree/number_identifier.rb
spree_core-4.7.0 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.3 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.2 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.1 app/models/concerns/spree/number_identifier.rb
spree_core-4.6.0 app/models/concerns/spree/number_identifier.rb
spree_core-4.5.3 app/models/concerns/spree/number_identifier.rb