Commit ba0e7b92 by Ryan Bigg

Merge pull request #164 from milabent/rails4

Fix usage of paranoia_column in related models
parents a57ce862 55adceee
...@@ -29,7 +29,7 @@ module Paranoia ...@@ -29,7 +29,7 @@ module Paranoia
end end
def only_deleted def only_deleted
with_deleted.where.not(paranoia_column => paranoia_sentinel_value) with_deleted.where.not(table_name => { paranoia_column => paranoia_sentinel_value} )
end end
alias :deleted :only_deleted alias :deleted :only_deleted
...@@ -180,9 +180,9 @@ class ActiveRecord::Base ...@@ -180,9 +180,9 @@ class ActiveRecord::Base
include Paranoia include Paranoia
class_attribute :paranoia_column, :paranoia_sentinel_value class_attribute :paranoia_column, :paranoia_sentinel_value
self.paranoia_column = options[:column] || :deleted_at self.paranoia_column = (options[:column] || :deleted_at).to_s
self.paranoia_sentinel_value = options.fetch(:sentinel_value) { Paranoia.default_sentinel_value } self.paranoia_sentinel_value = options.fetch(:sentinel_value) { Paranoia.default_sentinel_value }
default_scope { where(paranoia_column => paranoia_sentinel_value) } default_scope { where(table_name => { paranoia_column => paranoia_sentinel_value }) }
before_restore { before_restore {
self.class.notify_observers(:before_restore, self) if self.class.respond_to?(:notify_observers) self.class.notify_observers(:before_restore, self) if self.class.respond_to?(:notify_observers)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment