Commit 9203ca42 by Ivan Lan

association to_sym

parent 12c2c9b9
......@@ -33,7 +33,7 @@ module ActsAsPasting
module ClassMethods
def acts_as_pastable associations, prefix: '', **options
pasting_name = prefix.blank? ? "#{associations}_pastings" : [associations, prefix, 'pastings'].join('_').to_sym
pasting_name = prefix.blank? ? "#{associations}_pastings".to_sym : [associations, prefix, 'pastings'].join('_').to_sym
has_many(pasting_name, -> { where(type: prefix) }, as: :pasteable, class_name: 'ActsAsPasting::Pasting')
has_many(associations, through: pasting_name, source: :pasted, **options)
end
......
......@@ -202,7 +202,7 @@ module ActsAsPasting
end
def acts_as_pasted associations, prefix: '', **options
pasting_name = prefix.blank? ? "#{associations}_pastings" : [associations, prefix, 'pastings'].join('_').to_sym
pasting_name = prefix.blank? ? "#{associations}_pastings".to_sym : [associations, prefix, 'pastings'].join('_').to_sym
has_many(pasting_name, -> { where(type: prefix) }, class_name: 'ActsAsPasting::Pasting', as: :pasted)
has_many(associations, through: pasting_name, source: :pasteable, **options)
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