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.

There was a problem

This project is archived and is in readonly mode.

Find ignore select when conditions & include are specfied

#4767

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

Reported by arash · June 4th, 2010 @ 05:24 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Cesario
    Cesario
    • Tag changed from activerecord to 2.3.4, activerecord

    December 30th, 2010 @ 06:33 AM

  2. bingbing