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
109 110 111 |
# File 'lib/caboose/acts/paranoid.rb', line 109 def calculate(*args) with_deleted_scope { calculate_with_deleted(*args) } end |
#count(*args) ⇒ Object
105 106 107 |
# File 'lib/caboose/acts/paranoid.rb', line 105 def count(*args) with_deleted_scope { count_with_deleted(*args) } end |
#count_with_deleted(*args) ⇒ Object
101 102 103 |
# File 'lib/caboose/acts/paranoid.rb', line 101 def count_with_deleted(*args) calculate_with_deleted(:count, *(*args)) end |
#delete_all(conditions = nil) ⇒ Object
113 114 115 |
# File 'lib/caboose/acts/paranoid.rb', line 113 def delete_all(conditions = nil) self.update_all ["#{self.deleted_attribute} = ?", current_time], conditions end |
#exists?(*args) ⇒ Boolean
97 98 99 |
# File 'lib/caboose/acts/paranoid.rb', line 97 def exists?(*args) with_deleted_scope { exists_with_deleted?(*args) } end |
#find_with_deleted(*args) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/caboose/acts/paranoid.rb', line 84 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 |