Module: Platanus::ActivableBase::ClassMethods
- Defined in:
- lib/platanus/activable.rb
Instance Method Summary collapse
-
#after_remove(*_args, &_block) ⇒ Object
Shorthand method for adding callbacks after item removal.
-
#before_remove(*_args, &_block) ⇒ Object
Shorthand method for adding callbacks before item removal.
-
#remove_all ⇒ Object
Executes a mass remove, this wont call any callbacks!.
Instance Method Details
#after_remove(*_args, &_block) ⇒ Object
Shorthand method for adding callbacks after item removal
30 31 32 |
# File 'lib/platanus/activable.rb', line 30 def after_remove(*_args, &_block) self.set_callback :remove, :after, *_args, &_block end |
#before_remove(*_args, &_block) ⇒ Object
Shorthand method for adding callbacks before item removal
25 26 27 |
# File 'lib/platanus/activable.rb', line 25 def before_remove(*_args, &_block) self.set_callback :remove, :before, *_args, &_block end |
#remove_all ⇒ Object
Executes a mass remove, this wont call any callbacks!
17 18 19 20 21 22 |
# File 'lib/platanus/activable.rb', line 17 def remove_all # TODO: Find a way of doing mass updates and also call callbacks # self.update_all(:removed_at => DateTime.now) # For now, just call remove on each item self.all.each { |item| item.remove! } end |