Commit f185ce8a by John Hawthorn

Check that has_one references a paranoid model

parent d97417a2
......@@ -152,7 +152,10 @@ module Paranoia
association_find_conditions = { association_foreign_key => self.id }
end
Object.const_get(association_class_name).only_deleted.where(association_find_conditions).first.try(:restore, recursive: true)
association_class = Object.const_get(association_class_name)
if association_class.paranoid?
association_class.only_deleted.where(association_find_conditions).first.try!(:restore, recursive: true)
end
end
end
......
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