Displaying 1 result from an estimated 1 matches for "v2_order_lin".
Did you mean:
v2_order_lines
2013 Feb 18
6
How to clear ActiveRecord query cache on associations with dynamic table
...=>{:customer_id=>1}).all
Result: Select v1_order_lines.* FROM v1_order_lines INNER JOIN v1_orders ON
v1_orders.id=v1_order_lines.order_id WHERE v1_orders.customer_id=1
So far so good
Now we alter the table names:
Order.table_name=''v2_orders''
OrderLine.table_name=''v2_order_lines''
and requery:
Query:
OrderLine.joins(:order).where(Order.table_name=>{:customer_id=>1}).all
Result: Select v2_order_lines.* FROM v2_order_lines *INNER JOIN v1_orders
ON v1_orders.id*=v2_order_lines.order_id WHERE v2_orders.customer_id=1
Notice the INNER JOIN, it still uses the...