This project is archived and is in readonly mode.

#501 ✓resolved
Andrew White

Merge :joins instead of clobbering them

Reported by Andrew White | June 27th, 2008 @ 05:35 PM

The attached patch enhances with_scope, etc. by enabling the merging of :joins specified either in the new style or old style sql fragments.

1. Where both are new style they are merged in the same manner as :include.

2. Where both are strings they are concatenated together.

3. Where one is a new style and the other is a string then the new style :joins is converted to an sql fragment and then concatenated with the other sql fragment.

4. construct_finder_sql adds the DISTINCT sql keyword to limit the number of rows returned as joins generally multiply the number of rows returned - this is an enhancement to the change in ticket #46.

5. Tests have been added and all tests pass

6. Documentation has been updated to reflect that :joins as well as :include and :conditions are merged.

Comments and changes to this ticket

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

The new ticket tracker is available at <a href=""></a>

Shared Ticket Bins


Referenced by