Sha256: 720bd1f1042949df5d281737212c1552e37d4edee99ce0db62e5ec14ce65c01a
Contents?: true
Size: 660 Bytes
Versions: 1
Compression:
Stored size: 660 Bytes
Contents
class Ridgepole::DefaultsLimit DEFAULTS_LIMITS = { :mysql2 => { :boolean => 1, :integer => 4, :float => 24, :string => 255, :text => 65535, } } class << self def default_limit(column_type, options) defaults = DEFAULTS_LIMITS[adapter] || {} option_key = :"default_#{column_type}_limit" default_limit = options[option_key] || defaults[column_type] || 0 default_limit.zero? ? nil : default_limit end def adapter ActiveRecord::Base.connection_config.fetch(:adapter).to_sym rescue ActiveRecord::ConnectionNotEstablished nil end end # of class methods end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ridgepole-0.6.0.beta3 | lib/ridgepole/default_limit.rb |