Permalink
Browse files

no need to check for != true when showing deleted records. It's eithe…

…r Time/true or nil.
  • Loading branch information...
1 parent ff8ae28 commit 99de3097b9d35ba082e48a79661d6c128e17e30e @goncalossilva goncalossilva committed Oct 27, 2010
Showing with 1 addition and 15 deletions.
  1. +1 −15 lib/rails3_acts_as_paranoid.rb
@@ -14,20 +14,6 @@ def acts_as_paranoid(options = {})
raise ArgumentError, "'time' or 'boolean' expected for :column_type option, got #{configuration[:column_type]}"
end
- only_deleted_method_code =
- if configuration[:column_type] == 'time'
- <<-EOV
- self.unscoped.
- where("#{self.table_name}.#{configuration[:column]} IS NOT ?", nil)
-EOV
- else
- <<-EOV
- self.unscoped.
- where("#{self.table_name}.#{configuration[:column]} IS NOT ?
- OR #{self.table_name}.#{configuration[:column]} != ?", nil, true)
-EOV
- end
-
class_eval <<-EOV
default_scope where("#{self.table_name}.#{configuration[:column]} IS ?", nil)
@@ -37,7 +23,7 @@ def with_deleted
end
def only_deleted
- #{only_deleted_method_code}
+ self.unscoped.where("#{self.table_name}.#{configuration[:column]} IS NOT ?, nil)
end
def delete_all!(conditions = nil)

0 comments on commit 99de309

Please sign in to comment.