Module: Closet::Bury::InstanceMethods
- Defined in:
- lib/closet/bury/instance_methods.rb
Instance Method Summary collapse
- #buried? ⇒ Boolean
- #bury(options = { dependent: true }) ⇒ Object
- #bury!(options = { dependent: true }) ⇒ Object
Instance Method Details
#buried? ⇒ Boolean
25 26 27 |
# File 'lib/closet/bury/instance_methods.rb', line 25 def buried? self.reload && self.buried_at != nil end |
#bury(options = { dependent: true }) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/closet/bury/instance_methods.rb', line 5 def bury( = { dependent: true } ) begin self.bury!( dependent: .with_indifferent_access[:dependent] ) rescue false end end |
#bury!(options = { dependent: true }) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/closet/bury/instance_methods.rb', line 13 def bury!( = { dependent: true } ) if .with_indifferent_access[:dependent] ActiveRecord::Base.transaction do run_callbacks( :bury ) do flag_as_buried end end else flag_as_buried end end |