This project is archived and is in readonly mode.

#4012 ✓stale
rafmagana

[PATCH] add :noselect option to ActiveRecord#find

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

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.

Comments and changes to this ticket

  • Josh Kalderimis

    Josh Kalderimis May 12th, 2010 @ 11:56 AM

    Hi,

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

    Thanks

  • rafmagana

    rafmagana May 12th, 2010 @ 08:34 PM

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

  • rafmagana

    rafmagana June 1st, 2010 @ 04:00 AM

    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.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:51 PM

    • 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.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:51 PM

    • State changed from “open” to “stale”

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

Attachments

Pages