Commit 6402d2ab by liyijie

Add pasting_type to migration & fix acts_as_pasting spell error

parent 71c53bb3
......@@ -4,6 +4,7 @@ class CreateActsAsPastingPastings < ActiveRecord::Migration[5.2]
t.references :pasteable, polymorphic: true, index: { name: 'acts_as_pasting_pasteable' }
t.references :pasted, polymorphic: true, index: { name: 'acts_as_pasting_pasted' }
t.string :type, index: true
t.string :pasting_type
t.timestamps
end
......
......@@ -9,7 +9,7 @@ module ActsAsPasting
scope :pasted_with_any, ->(ary) {
ary = parsed_condition_ary(ary)
ary.map { |klass, id| joins(:pastings).where(
'acts_as_pastings_pastings.pasteable_type = ? AND acts_as_pastings_pastings.pasteable_id = ?',
'acts_as_pasting_pastings.pasteable_type = ? AND acts_as_pasting_pastings.pasteable_id = ?',
klass.constantize.base_class.name, id
)
}.reduce(:or)&.distinct || self.none
......
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