On Fri, Feb 5, 2016, at 00:50, Colin Law wrote:
> You don't need the first two lines, you just need something like
> Initiative.all.map {|initiative| [initiative.name,
> initiative.trainings.count] }
>
That'll be slow. The alternative is to include `:trainings` but then
it'll transfer a bunch of unnecessary data as well.
--
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+unsubscribe@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/1454601282.4123550.511992130.7A298AEF%40webmail.messagingengine.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment