Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

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

#6384

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).

Reported by Raimonds Simanovskis · February 7th, 2011 @ 04:47 PM

State: resolved
Milestone: none
Assigned to: Aaron Patterson Aaron Patterson
Importance: Low

Activity

  1. Aaron Patterson
    Aaron Patterson
    • 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.

    February 21st, 2011 @ 11:05 PM