+1

I find one of the most frequent uses of find_each/find_in_batches is
looping through a large collection in order to queue up a list of ids for a
background job to process. e.g. queuing up a big list of user ids to send
an email to. Would be nice to avoid the overhead of AR objects and just do
something like:

    User.some_scopes.pluck_each(:id) { |id| ... }
    User.some_scopes.pluck_in_batches { |batch| ... }

Or maybe pluck could be an alternative to select?

    User.some_scopes.pluck(:id).find_each { |id| ... }


On Sun, Jun 14, 2015 at 2:07 PM, Vipul A M <[email protected]> wrote:

> Can you share an example of this proposal?
> Vipul A.M.
> +91-8149-204995
>
>
> On Sun, Jun 14, 2015 at 11:26 PM, Paco Guzmán <[email protected]>
> wrote:
> >
> > I would like to provide a new feature on Rails that consist on the use of
> > pluck when using find_each/find_in_batches to speed up the loop when is
> not
> > need to access to active record instances.
> >
> > Do you think this could be incorporated in Rails? For the moment I'm
> going
> > to implement a solution for our use case on a Rails 3.2 app
> >
> > Thanks in advance
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Core" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/rubyonrails-core.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to