Commit ec04c682 by Martin Sereinig Committed by John Hawthorn

FIX: where("association_id", id) leads to invalid statement in postgres. where…

FIX: where("association_id", id) leads to invalid statement in postgres. where should just be given a hash.
parent e302d75e
...@@ -144,7 +144,7 @@ module Paranoia ...@@ -144,7 +144,7 @@ module Paranoia
if association_data.nil? && association.macro.to_s == "has_one" if association_data.nil? && association.macro.to_s == "has_one"
association_class_name = association.options[:class_name].present? ? association.options[:class_name] : association.name.to_s.camelize association_class_name = association.options[:class_name].present? ? association.options[:class_name] : association.name.to_s.camelize
association_foreign_key = association.options[:foreign_key].present? ? association.options[:foreign_key] : "#{self.class.name.to_s.underscore}_id" association_foreign_key = association.options[:foreign_key].present? ? association.options[:foreign_key] : "#{self.class.name.to_s.underscore}_id"
Object.const_get(association_class_name).only_deleted.where(association_foreign_key, self.id).first.try(:restore, recursive: true) Object.const_get(association_class_name).only_deleted.where(association_foreign_key => self.id).first.try(:restore, recursive: true)
end 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