Commit ae8c4f95 by John Hawthorn

Use alias_method in acts_as_paranoid

alias defines these on ActiveRecord::Base itself, which is not what was
intended. This behaviour previous differed between MRI and jruby.
parent 65e2195e
...@@ -207,9 +207,9 @@ end ...@@ -207,9 +207,9 @@ end
class ActiveRecord::Base class ActiveRecord::Base
def self.acts_as_paranoid(options={}) def self.acts_as_paranoid(options={})
alias :really_destroyed? :destroyed? alias_method :really_destroyed?, :destroyed?
alias :really_delete :delete alias_method :really_delete, :delete
alias :destroy_without_paranoia :destroy alias_method :destroy_without_paranoia, :destroy
include Paranoia include Paranoia
class_attribute :paranoia_column, :paranoia_sentinel_value class_attribute :paranoia_column, :paranoia_sentinel_value
......
...@@ -392,9 +392,9 @@ class ParanoiaTest < test_framework ...@@ -392,9 +392,9 @@ class ParanoiaTest < test_framework
# Just to demonstrate the AR behaviour # Just to demonstrate the AR behaviour
model = NonParanoidModel.new model = NonParanoidModel.new
model.destroy! model.destroy!
assert model.really_destroyed? assert model.destroyed?
model.destroy! model.destroy!
assert model.really_destroyed? assert model.destroyed?
# Mirrors behaviour above # Mirrors behaviour above
model = ParanoidModel.new model = ParanoidModel.new
......
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