Module: Caboose::Acts::Paranoid::InstanceMethods::ClassMethods
- Defined in:
- lib/caboose/acts/paranoid.rb
Instance Method Summary collapse
- #calculate(*args) ⇒ Object
- #count(*args) ⇒ Object
- #count_with_deleted(*args) ⇒ Object
- #delete_all(conditions = nil) ⇒ Object
- #exists?(*args) ⇒ Boolean
- #find_with_deleted(*args) ⇒ Object
Instance Method Details
#calculate(*args) ⇒ Object
102 103 104 |
# File 'lib/caboose/acts/paranoid.rb', line 102 def calculate(*args) with_deleted_scope { calculate_with_deleted(*args) } end |
#count(*args) ⇒ Object
98 99 100 |
# File 'lib/caboose/acts/paranoid.rb', line 98 def count(*args) with_deleted_scope { count_with_deleted(*args) } end |
#count_with_deleted(*args) ⇒ Object
94 95 96 |
# File 'lib/caboose/acts/paranoid.rb', line 94 def count_with_deleted(*args) calculate_with_deleted(:count, *(*args)) end |
#delete_all(conditions = nil) ⇒ Object
106 107 108 |
# File 'lib/caboose/acts/paranoid.rb', line 106 def delete_all(conditions = nil) self.update_all ["#{self.deleted_attribute} = ?", current_time], conditions end |
#exists?(*args) ⇒ Boolean
90 91 92 |
# File 'lib/caboose/acts/paranoid.rb', line 90 def exists?(*args) with_deleted_scope { exists_with_deleted?(*args) } end |
#find_with_deleted(*args) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/caboose/acts/paranoid.rb', line 77 def find_with_deleted(*args) = args. () set_readonly_option!() [:with_deleted] = true # yuck! case args.first when :first then find_initial() when :all then find_every() else find_from_ids(args, ) end end |