This project is archived and is in readonly mode.
ActiveRecord 3.0.3 and 3-0-stable generate invalid SQL for has_many :through association with :conditions
Reported by Raimonds Simanovskis | February 7th, 2011 @ 04:47 PM
If has_many :through association has :conditions option then generated SQL is missing either join conditions or specified additional conditions from :conditions
See test case how to reproduce the issue and the generated
results by different versions of ActiveRecord and Arel
https://gist.github.com/ca8d82d1dd70f73c51de
If ActiveRecord from Rails master branch and Arel master branch is used then correct SQL is generated. It would be good to fix this bug also in upcoming Rails 3.0.4 version (current version from 3-0-stable branch is producing invalid SQL).
Comments and changes to this ticket
-
Aaron Patterson February 21st, 2011 @ 11:05 PM
- State changed from new to resolved
- Importance changed from to Low
I've fixed this in Arel here:
https://github.com/rails/arel/commit/64d21596950df4599bc6ea8a7b6356...
It will be released with arel 2.0.9.
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>