lib/arel/engines/sql/relations/operations/join.rb in arel-0.3.3 vs lib/arel/engines/sql/relations/operations/join.rb in arel-0.4.0

- old
+ new

@@ -8,10 +8,10 @@ @joins ||= begin this_join = [ join_sql, relation2.externalize.table_sql(formatter), ("ON" unless predicates.blank?), - (ons + relation2.externalize.wheres).collect { |p| p.bind(environment).to_sql(Sql::WhereClause.new(environment)) }.join(' AND ') + (ons + relation2.externalize.wheres).collect { |p| p.bind(environment.relation).to_sql(Sql::WhereClause.new(environment)) }.join(' AND ') ].compact.join(" ") [relation1.joins(environment), this_join, relation2.joins(environment)].compact.join(" ") end end end