Sha256: e77356c409210ac99b19c87570d297ebb33d11682f5692f6d43a6f0a2eda045e

Contents?: true

Size: 448 Bytes

Versions: 4

Compression:

Stored size: 448 Bytes

Contents

# frozen_string_literal: true

module StringLengthLimit
  # Default string length limit for model attributes. When running on MySQL,
  # this is equal to the default string length in the database as set by Rails.
  STRING_LIMIT = 255

  extend ActiveSupport::Concern

  class_methods do
    def validates_default_string_length(*names)
      names.each do |name|
        validates name, length: { maximum: STRING_LIMIT }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
publify_core-10.0.2 app/models/concerns/string_length_limit.rb
publify_core-10.0.1 app/models/concerns/string_length_limit.rb
publify_core-10.0.0 app/models/concerns/string_length_limit.rb
publify_core-9.2.10 app/models/concerns/string_length_limit.rb