This project is archived and is in readonly mode.

#975 ✓duplicate
mtkd

ActiveRecord: SELECT clause breaks when INCLUDE added

Reported by mtkd | September 5th, 2008 @ 12:58 PM | in 2.x

This issue occurs on 2.1 and trunk:

This works - returns all the fields plus "something":

  find(:all,
       :select => "* , table1.field AS something",
       :joins => "LEFT JOIN table3 ON table3.field = table4.id AND table3.user_id = #{curruser.id}",
       :conditions => ["some clauses"]

This does not return "something" (:include and :order have been added):

  find(:all,
       :select => "* , table1.field AS something",
       :include => [:table2],
       :joins => "LEFT JOIN table3 ON table3.field = table4.id AND table3.user_id = #{curruser.id}",
       :conditions => ["some clauses"]
       :order => "table2.sort_order ASC"

Comments and changes to this ticket

  • Tarmo Tänav

    Tarmo Tänav September 18th, 2008 @ 04:25 AM

    • State changed from “new” to “duplicate”

    There's a newer ticket #1060 with a patch that supposedly does implement this (though this has never before worked and there has always been an assumption that it is not going to)

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>

People watching this ticket

Pages