Module: ActiveRecord::Acts::Deactivatable::ClassMethods

Defined in:
lib/deactivatable.rb

Instance Method Summary collapse

Instance Method Details

#deactivatable_optionsObject



31
32
33
# File 'lib/deactivatable.rb', line 31

def deactivatable_options
  @deactivatable_options || self.superclass.deactivatable_options || {}
end

#remove_deactivated_objects_scopeObject

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_scopeObject

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