Ruby on Rails Thursday, July 2, 2015

Hi


I have a basic active query like so:


m = Movie.includes(:genres)

`m.genders` is an `CollectionProxy` in this case. Is there a way I can get this as an array?

I know that calling to_a will do this, but this becomes impractical for a bunch of includes.


The problem that I am having is that when I cache m in redis after fetching it the genres query is done again if I don't iterate the collection.


Regards,


--
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/ab9f2f03-674d-4159-b1dc-a29be828f690%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment