Module: Reusable::Rails::Models::Paranoid::InstanceMethods

Defined in:
lib/reusable/rails/models/paranoid.rb

Instance Method Summary collapse

Instance Method Details

#deactivate!Object



25
26
27
# File 'lib/reusable/rails/models/paranoid.rb', line 25

def deactivate!
  update_attributes({:deleted_at => Time.now.utc})
end

#is_hidden?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/reusable/rails/models/paranoid.rb', line 33

def is_hidden?
  !is_visible?
end

#is_visible?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/reusable/rails/models/paranoid.rb', line 29

def is_visible?
  self.deleted_at.blank?
end

#reactivate!(attrs = {}) ⇒ Object



20
21
22
23
# File 'lib/reusable/rails/models/paranoid.rb', line 20

def reactivate!(attrs={})
  self.attributes = {:deleted_at => nil}.merge(attrs)
  save
end