Hassan Schroeder wrote in post #1149759:
> On Sun, Jun 15, 2014 at 1:29 AM, Ronald Fischer <li...@ruby-forum.com>
> wrote:
> (assume that ) box = Box.find(box_id)
>
> box.cards  #  has the cards you want *if* you need all the attributes
>
> box.cards.pluck(:id)  #  builds a query to fetch *only* the card ids

May I ask how this works (internally)? For pluck() to be applied, Ruby 
has first to execute box.cards() to get an Array of the cards. Unless 
the Card objects are implemented as proxies, which only fetch their data 
from the database if one asks for it, I would at this point, at least 
temporarily, have all the selected Card data in memory, isn't it?

Ronald

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2845a06ed41c1407411b5ac77b8318b0%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to