Class: Class
- Inherits:
-
Object
- Object
- Class
- Defined in:
- lib/validation_profiler/class_methods.rb
Instance Method Summary collapse
-
#validates(field, rule, attributes = {}) ⇒ Object
- DEPRECIATED
-
do not use, please use ‘extend ValidationProfiler’ instead Specifies a validation rule to use within a validation profile.
Instance Method Details
#validates(field, rule, attributes = {}) ⇒ Object
- DEPRECIATED
-
do not use, please use ‘extend ValidationProfiler’ instead
Specifies a validation rule to use within a validation profile.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/validation_profiler/class_methods.rb', line 9 def validates(field, rule, attributes = {}) puts "[ValidationProfile] - Method depreciated. Please use 'extend ValidationProfiler' in your validation profile class to access the 'validates' method." if !self.class_variable_defined?(:@@validation_rules) self.class_variable_set(:@@validation_rules, []) end validation_rules = self.class_variable_get(:@@validation_rules) validation_rules.push({ name: rule, field: field, attributes: attributes }) self.class_variable_set(:@@validation_rules, validation_rules) end |