Skip to content

Commit

Permalink
ActiveRecord::PredicateBuilder#expand to be private
Browse files Browse the repository at this point in the history
This method is not touched from outside.
  • Loading branch information
yui-knk committed Aug 7, 2016
1 parent 0d12708 commit 2302691
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions activerecord/lib/active_record/relation/predicate_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,6 @@ def create_binds(attributes)
create_binds_for_hash(attributes)
end

def expand(column, value)
# 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)
value = AssociationQueryHandler.value_for(table, column, value) if table.associated_with?(column)
build(table.arel_attribute(column), value)
end

def self.references(attributes)
attributes.map do |key, value|
if value.is_a?(Hash)
Expand Down Expand Up @@ -131,6 +121,16 @@ def create_binds_for_hash(attributes)

private

def expand(column, value)
# 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)
value = AssociationQueryHandler.value_for(table, column, value) if table.associated_with?(column)
build(table.arel_attribute(column), value)
end

def associated_predicate_builder(association_name)
self.class.new(table.associated_table(association_name))
end
Expand Down

0 comments on commit 2302691

Please sign in to comment.