On Wednesday, August 24, 2016 at 1:49:48 PM UTC+1, Bazley wrote: > > The first thing I do with it is this: > > if @new_relationships.any? > > So it looks like .any? affects the query? I would have thought rails would > perform the query, get all the records into @new_relationships, and then > count them. This is a surprising feature. >
What rails is trying to avoid is loading 1000 objects from the db, just to check whether there is > 0 objects. If the query had already run, then it would just could the loaded objects. Fred -- 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/10a1fce4-7618-498b-a613-07500f909bdb%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.