pluck doesn't return a Relation?

25 views
Skip to first unread message

Kwasi Mensah

unread,
Sep 12, 2016, 2:24:34 AM9/12/16
to Ruby on Rails: Talk
I'm looking into using pluck at the end of a query that might have a fair amount of results and was surprised ActiveRecord::Calculations::pluck didn't return a relation. This means I can't use find_each to try to be smart about how much data is in memory at a time.

Is there a reasoning behind this or is it just not supported yet? I quick glance of the source doesn't seem like relations are requred to only hold ActiveRecord objects.

Kwasi

ActiveRecord::CalculationsActiveRecord::Calculations

Jarmo Isotalo

unread,
Sep 13, 2016, 5:27:07 AM9/13/16
to Ruby on Rails: Talk
The pluck is like the only way of getting raw data from bw w/o any ORM object creations. 
So it might be worth explaining what exactly you are trying to achieve so that someone could hint towards a more suitable method to use...
Reply all
Reply to author
Forward
0 new messages