I made a patch to allow eager loading to exclude specified columns on the
eagerly-loaded models. If you have a model that you want to load for a
specific reason -- like, say, you have lots of users, and you want to grab
all their posts but exclude the posts' bodies -- you can now specify that by
going:

User.find(:all, :include => {:posts => {:except => :body}})

I found this useful in my application when I was trying to grab a huge
amount of emails and didn't want to include their bodies. Without body
loading, the emails loaded in a a few milliseconds: with the bodies included
they took lots longer.

The ticket for this change is here:
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3662-exclude-fields-from-eager-loaded-models
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-c...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to