Module: Armada::Callbacks::ClassMethods
- Defined in:
- lib/armada/callbacks.rb
Instance Method Summary collapse
Instance Method Details
#after_validation(*args, &block) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/armada/callbacks.rb', line 34 def after_validation(*args, &block) = args. [:prepend] = true [:if] = Array([:if]) [:if] << "!halted && value != false" [:if] << "@_on_validate == :#{[:on]}" if [:on] set_callback(:validation, :after, *(args << ), &block) end |
#before_validation(*args, &block) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/armada/callbacks.rb', line 25 def before_validation(*args, &block) = args.last if .is_a?(Hash) && [:on] [:if] = Array([:if]) [:if] << "@_on_validate == :#{[:on]}" end set_callback(:validation, :before, *args, &block) end |