Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

193 doesn't like : in Whens

  • Loading branch information...
commit 9f3bbf5964e8f22cce4cd94e994732907477c1ec 1 parent 166b15d
@farski farski authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 lib/is_paranoid.rb
View
14 lib/is_paranoid.rb
@@ -44,7 +44,7 @@ def self.count_only_destroyed *args
def self.find_with_destroyed *args
self.with_destroyed_scope { find(*args) }
end
-
+
# Perform a find only on destroyed instances.
def self.find_only_destroyed *args
self.with_only_destroyed_scope { find(*args) }
@@ -85,15 +85,15 @@ def restore
def destroyed?
super || !deleted_at.nil?
end
-
+
protected
# Mark the model deleted_at as now.
def destroy_without_callbacks
- self.deleted_at = Time.now
+ self.deleted_at = Time.now
update_without_callbacks
end
-
+
def self.with_only_destroyed_scope(&block)
with_destroyed_scope do
table = connection.quote_table_name(table_name)
@@ -110,15 +110,15 @@ def self.with_destroyed_scope
begin
case find[:conditions]
- when Hash:
+ when Hash
if find[:conditions][:deleted_at].nil?
find[:conditions].delete(:deleted_at)
end
- when String:
+ when String
conditions = sanitize_conditions(:deleted_at => nil)
find[:conditions].gsub!(conditions, '1=1')
end
-
+
result = yield
ensure
find[:conditions] = original

0 comments on commit 9f3bbf5

Please sign in to comment.
Something went wrong with that request. Please try again.