method
expand
expand(klass, table, column, value)
public
Hide source
# File activerecord/lib/active_record/relation/predicate_builder.rb, line 35 def self.expand(klass, table, column, value) queries = [] # Find the foreign key when using queries such as: # Post.where(author: author) # # For polymorphic relationships, find the foreign key and type: # PriceEstimate.where(estimate_of: treasure) if klass && value.class < Base && reflection = klass.reflect_on_association(column.to_sym) if reflection.polymorphic? queries << build(table[reflection.foreign_type], value.class.base_class) end column = reflection.foreign_key end queries << build(table[column], value) queries end