Commit 1aa69952 by Ivan Lan

Fix scope

parent 72f63acb
...@@ -10,7 +10,7 @@ module ActsAsPasting ...@@ -10,7 +10,7 @@ module ActsAsPasting
scope :pasted_with_any, ->(ary, prefix: '') { scope :pasted_with_any, ->(ary, prefix: '') {
ary = parsed_condition_ary(ary) ary = parsed_condition_ary(ary)
ids = ary.map do |klass, id| ids = ary.map do |klass, id|
joins(:pastings).where(pastings: { joins(:pastings).where(acts_as_pasting_pastings: {
pasteable_type: klass.constantize.base_class.name, pasteable_id: id, type: prefix pasteable_type: klass.constantize.base_class.name, pasteable_id: id, type: prefix
}).pluck(:id) }).pluck(:id)
end.reduce(:|) end.reduce(:|)
...@@ -20,7 +20,7 @@ module ActsAsPasting ...@@ -20,7 +20,7 @@ module ActsAsPasting
scope :pasted_with_all, ->(ary, prefix: '') { scope :pasted_with_all, ->(ary, prefix: '') {
ary = parsed_condition_ary(ary) ary = parsed_condition_ary(ary)
ids = ary.map do |klass, id| ids = ary.map do |klass, id|
joins(:pastings).where(pastings: { joins(:pastings).where(acts_as_pasting_pastings: {
pasteable_type: klass.constantize.base_class.name, pasteable_id: id, type: prefix pasteable_type: klass.constantize.base_class.name, pasteable_id: id, type: prefix
}).pluck(:id) }).pluck(:id)
end.reduce(:&) end.reduce(:&)
......
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