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.

[PATCH] add :noselect option to ActiveRecord#find

#4012

I've found myself in the need to discard one or two columns when I call ActiveRecord#find (all, first, last, etc), let's say the users table have 5 columns and I don't want one of them I do this:

User.all(:select => "col_1, col_2, col_3, col_4")

why don't just do:

User.all(:noselect => "col_5")

well, this patch lets you do that.

Reported by rafmagana · February 20th, 2010 @ 07:35 PM

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

Activity

  1. Josh Kalderimis
    Josh Kalderimis

    Hi,

    Please add tests showing that this patch works for an array of symbols and string of :no_select values.

    Thanks

    May 12th, 2010 @ 11:56 AM

  2. rafmagana
    rafmagana

    ok, Josh, I'll do so as soon as I can. Thanks.

    May 12th, 2010 @ 08:34 PM

  3. rafmagana
    rafmagana

    Excuse me, why do you want my patch to work with an array of symbols if the ActiveRecord#find method doesn't support it?

    I mean User.all(:select => [:created_at, :updated_at]) won't work, so :no_select shouldn't either, don't you think?

    I actually haven't checked out 2.3.6, 2.3.7 nor 2.3.8 I don't know if it works in those versions, please, let me know.

    Thanks in advance.

    June 1st, 2010 @ 04:00 AM

  4. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:51 PM

  5. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:51 PM