Module: SmartFieldConstraints::Extensions::Validations::ClassMethods
- Defined in:
- lib/smart_field_constraints/extensions/validations.rb
Class Method Summary collapse
-
.extended(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#validates_length_of_with_smart_constraints(*attrs) ⇒ Object
Tracks what the maximum value is that’s allowed for all of the attributes being validated.
-
#validates_size_of_with_smart_constraints(*attrs) ⇒ Object
Tracks what the maximum value is that’s allowed for all of the attributes being validated.
Class Method Details
.extended(base) ⇒ Object
:nodoc:
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/smart_field_constraints/extensions/validations.rb', line 13 def self.extended(base) #:nodoc: base.class_eval do class_inheritable_hash :smart_length_constraints self.smart_length_constraints = {} end class << base alias_method_chain :validates_length_of, :smart_constraints alias_method_chain :validates_size_of, :smart_constraints end end |
Instance Method Details
#validates_length_of_with_smart_constraints(*attrs) ⇒ Object
Tracks what the maximum value is that’s allowed for all of the attributes being validated
27 28 29 30 |
# File 'lib/smart_field_constraints/extensions/validations.rb', line 27 def validates_length_of_with_smart_constraints(*attrs) track_length_constraints(attrs) validates_length_of_without_smart_constraints(*attrs) end |
#validates_size_of_with_smart_constraints(*attrs) ⇒ Object
Tracks what the maximum value is that’s allowed for all of the attributes being validated
34 35 36 37 |
# File 'lib/smart_field_constraints/extensions/validations.rb', line 34 def validates_size_of_with_smart_constraints(*attrs) track_length_constraints(attrs) validates_size_of_without_smart_constraints(*attrs) end |