Commit 9a26d811 by John Hawthorn Committed by GitHub

Merge pull request #436 from jhawthorn/rails_5_2_patches

Improvements to rails 5.2 patches
parents 82ba504e c33f3a65
require 'active_record' unless defined? ActiveRecord
require 'paranoia/active_record_patches'
if [ActiveRecord::VERSION::MAJOR, ActiveRecord::VERSION::MINOR] == [5, 2]
require 'paranoia/active_record_5_2'
end
module Paranoia
@@default_sentinel_value = nil
......
......@@ -5,8 +5,8 @@ module HandleParanoiaDestroyedInBelongsToAssociation
case options[:dependent]
when :destroy
target.destroy
if defined? target.deleted?
raise ActiveRecord::Rollback unless target.deleted?
if target.respond_to?(:paranoia_destroyed?)
raise ActiveRecord::Rollback unless target.paranoia_destroyed?
else
raise ActiveRecord::Rollback unless target.destroyed?
end
......@@ -25,8 +25,8 @@ module HandleParanoiaDestroyedInHasOneAssociation
when :destroy
target.destroyed_by_association = reflection
target.destroy
if defined? target.deleted?
throw(:abort) unless target.deleted?
if target.respond_to?(:paranoia_destroyed?)
throw(:abort) unless target.paranoia_destroyed?
else
throw(:abort) unless target.destroyed?
end
......
......@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.required_ruby_version = '>= 2.0'
s.add_dependency 'activerecord', '>= 4.0', '< 5.2'
s.add_dependency 'activerecord', '>= 4.0', '< 5.3'
s.add_development_dependency "bundler", ">= 1.0.0"
s.add_development_dependency "rake"
......
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