This project is archived and is in readonly mode.
Find ignore select when conditions & include are specfied
Reported by arash | June 4th, 2010 @ 05:24 PM
I expected that if I specify the :select option inside a find tag, it will always be respected; but apparently, if also specify conditions which rely on an 'included' model, it just does a select *:
?> Comment.first(:select => 'comments.*', :conditions
=> "users.first_name = 'Arash'", :include => :user) Comment
Load Including Associations (0.9ms) SELECT
comments.id AS t0_r0,
comments.comment AS t0_r1,
comments.owner_table AS t0_r2,
comments.owner_id AS t0_r3,
comments.user_id AS t0_r4,
comments.status_id AS t0_r5,
comments.deleted AS t0_r6,
comments.created_at AS t0_r7,
comments.updated_at AS t0_r8,
users.id AS t1_r0,
users.account_name AS t1_r1,
users.first_name AS t1_r2,
users.last_name AS t1_r3,
users.email AS t1_r4,
users.deleted AS t1_r8,
users.created_at AS t1_r9,
users.updated_at AS t1_r10 FROM
comments LEFT OUTER JOIN users ON
users.id = comments.user_id AND
users.deleted = 0 WHERE ((
users.first_name = 'Arash' ) AND
comments.deleted = 0) LIMIT 1
The occurs in rails 2.3.4
Comments and changes to this ticket
-

Cesario December 30th, 2010 @ 06:33 AM
- Tag changed from activerecord to 2.3.4, activerecord
-

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>