ActiveRecord – Making :include and :select play nice!

So I have been using a nice plug-in that will allow me to using :select when using :include, and not have it pull the entire data set. You can add the plug-in to your app like this:

script/plugin install git://

Here are some ways to use the plug-in:

Employee.find :all,
  :select => ", address.state, employees.*",
  :include => :address

Employee.find :first,
  :select => "now() as current_time,, DATE(addresses.created_at) as addresses.created_at, employee.*",
  :include => :address

Employee.find :all,
  :select => ",, employees.start_date",
  :include => :address

Examples taken from:

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: