Module: Sequel::Plugins::NotNaughty::Hooks
- Defined in:
- lib/sequel_not_naughty.rb
Overview
Adds validation hooks to Sequel::Model.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/sequel_not_naughty.rb', line 86 def self.included(base) base.instance_eval do def_hook_method :before_validate def_hook_method :after_validate unless instance_methods.include? 'validate_without_hooks' alias_method :validate_without_hooks, :validate alias_method :validate, :validate_with_hooks end end end |
Instance Method Details
#after_validate ⇒ Object
98 |
# File 'lib/sequel_not_naughty.rb', line 98 def after_validate() end |
#before_validate ⇒ Object
97 |
# File 'lib/sequel_not_naughty.rb', line 97 def before_validate() end |
#validate_with_hooks ⇒ Object
100 101 102 103 104 |
# File 'lib/sequel_not_naughty.rb', line 100 def validate_with_hooks before_validate validate_without_hooks after_validate end |