Module: ActiveRecord::Acts::Deactivatable::ClassMethods
- Defined in:
- lib/deactivatable.rb
Instance Method Summary collapse
- #deactivatable_options ⇒ Object
-
#remove_deactivated_objects_scope ⇒ Object
Remove any scope related to deactivated_at and yield.
-
#with_deactivated_objects_scope ⇒ Object
Yields to a block, executing that block after removing the deactivated_at scope.
Instance Method Details
#deactivatable_options ⇒ Object
31 32 33 |
# File 'lib/deactivatable.rb', line 31 def @deactivatable_options || self.superclass. || {} end |
#remove_deactivated_objects_scope ⇒ Object
Remove any scope related to deactivated_at and yield.
47 48 49 50 51 |
# File 'lib/deactivatable.rb', line 47 def remove_deactivated_objects_scope with_exclusive_scope(scoped_methods_without_deactivated_at_scope) do yield end end |
#with_deactivated_objects_scope ⇒ Object
Yields to a block, executing that block after removing the deactivated_at scope.
37 38 39 40 41 42 43 |
# File 'lib/deactivatable.rb', line 37 def with_deactivated_objects_scope remove_deactivated_objects_scope do with_scope(:find => {:conditions => "`#{self.table_name}`.`deactivated_at` IS NOT NULL"}) do yield end end end |