This project is archived and is in readonly mode.

#3071 ✓stale
Greg Dan

Bad table name when using join and hash condition

Reported by Greg Dan | August 19th, 2009 @ 10:38 AM

Here is an example from Rails Guides

time_range = (Time.now.midnight - 1.day)..Time.now.midnight

Client.all :joins => :orders, :conditions => {:orders => {:created_at => time_range}}

If the orders table is using non standard table name, set with set_table_name, then above creates wrong condition. ":joins => :orders" works fine. However the hash condition always produces "orders" for the table name. I guess the hash condition doesn't take correct table name, the name which is set via set_table_name.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages