activerecord-hackery--ransack/lib/polyamorous/activerecord_6.0_ruby_2/reflection.rb

12 lines
275 B
Ruby
Raw Normal View History

2022-03-04 12:58:28 +00:00
module Polyamorous
module ReflectionExtensions
def join_scope(table, foreign_table, foreign_klass)
if respond_to?(:polymorphic?) && polymorphic?
super.where!(foreign_table[foreign_type].eq(klass.name))
else
super
end
end
end
end