eload-select plugin to the rescue!
Employee.find :all, :select => 'addresses.city, address.state, employees.*', :include => :address
The advantages of the eload-select plugin:
- Works with aliases and database functions
- Plays nice with other plugins like ar-extensions
- Selects columns on the base table (some options force you to select all of the base table)
Employee.find :first, :select => 'now() as current_time, addresses.city, DATE(addresses.created_at) as addresses.created_at, employee.*' :include => :address
Employee.find :all, :select => 'addresses.city, employees.name, employees.start_date', :include => :address
script/plugin install git://github.com/blythedunham/eload-select.git
And your off! Recently updated to work with all versions of rails including 2.3.