Module: Platanus::Activable::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
35 36 37 |
# File 'lib/platanus/activable.rb', line 35 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
30 31 32 |
# File 'lib/platanus/activable.rb', line 30 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!
22 23 24 25 26 27 |
# File 'lib/platanus/activable.rb', line 22 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 |