Module: ActiveRecord::Acts::Deactivatable::InstanceMethods

Defined in:
lib/deactivatable.rb

Instance Method Summary collapse

Instance Method Details

#activate!Object

Activate this object, and any associated objects as specified at definition time.



90
91
92
93
94
95
96
# File 'lib/deactivatable.rb', line 90

def activate!
  with_transaction do
    self.deactivated_at = nil
    activate_dependencies
    self.save!            
  end
end

#deactivate!Object

Deactivate this object, and any associated objects as specified at definition time.



80
81
82
83
84
85
86
# File 'lib/deactivatable.rb', line 80

def deactivate!
  with_transaction do
    self.deactivated_at = Time.now            
    deactivate_dependencies
    self.save(false)
  end
end

#deactivated?Boolean

Returns:

  • (Boolean)


98
99
100
# File 'lib/deactivatable.rb', line 98

def deactivated?
  deactivated_at?
end