Module: FragmentedValidation::InstanceMethods
- Defined in:
- lib/fragmented_validation/core.rb
Instance Method Summary collapse
- #fragmented_validation(*attrs) ⇒ Object
- #fragmented_validation_except(*attrs) ⇒ Object
- #fragmented_validation_on(*attrs) ⇒ Object
Instance Method Details
#fragmented_validation(*attrs) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/fragmented_validation/core.rb', line 29 def fragmented_validation(*attrs) valid? _errors = {} attrs.flatten.uniq.each do |attr| _errors[attr] = errors[attr] end errors.clear _errors.each_pair do |key, values| values.each do |val| errors.add(key, val) end end errors.empty? end |
#fragmented_validation_except(*attrs) ⇒ Object
25 26 27 |
# File 'lib/fragmented_validation/core.rb', line 25 def fragmented_validation_except(*attrs) fragmented_validation(attributes.keys - attrs.map{|att| att.to_s}) end |
#fragmented_validation_on(*attrs) ⇒ Object
21 22 23 |
# File 'lib/fragmented_validation/core.rb', line 21 def fragmented_validation_on(*attrs) fragmented_validation(attrs) end |