Skip to content

Commit

Permalink
Remove duplicates when mixing bound variables from generated subquery…
Browse files Browse the repository at this point in the history
… with joined relation
  • Loading branch information
take-five committed Dec 28, 2014
1 parent 949e13b commit 55e34ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/active_record/hierarchical_query/join_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def initialize(query, join_to, subquery_alias)

def build
relation = @relation.joins(inner_join.to_sql)
# copy bound variables from inner subquery
relation.bind_values += bind_values
# copy bound variables from inner subquery (remove duplicates)
relation.bind_values |= bind_values
# add ordering by "__order_column"
relation.order_values += order_columns if ordered?

Expand Down

0 comments on commit 55e34ed

Please sign in to comment.