Module: ActiveRecordExtensions::ValidationReflection::ClassMethods
- Defined in:
- lib/vendor/plugins/validation_reflection/lib/validation_reflection.rb
Constant Summary
Constants included from ActiveRecordExtensions::ValidationReflection
Instance Method Summary collapse
-
#reflect_on_all_validations ⇒ Object
Returns an array of MacroReflection objects for all validations in the class.
-
#reflect_on_validations_for(attr_name) ⇒ Object
Returns an array of MacroReflection objects for all validations defined for the field
attr_name
.
Methods included from ActiveRecordExtensions::ValidationReflection
#included, #install, #load_config
Instance Method Details
#reflect_on_all_validations ⇒ Object
Returns an array of MacroReflection objects for all validations in the class
107 108 109 |
# File 'lib/vendor/plugins/validation_reflection/lib/validation_reflection.rb', line 107 def reflect_on_all_validations self.read_inheritable_attribute(:validations) || [] end |
#reflect_on_validations_for(attr_name) ⇒ Object
Returns an array of MacroReflection objects for all validations defined for the field attr_name
.
112 113 114 115 116 |
# File 'lib/vendor/plugins/validation_reflection/lib/validation_reflection.rb', line 112 def reflect_on_validations_for(attr_name) self.reflect_on_all_validations.select do |reflection| reflection.name == attr_name.to_sym end end |