Ticket 7147, among others, discusses support for restricting attribute selection for finds that do eager-loading.
A core team member was not enthusiastic about approaches that required the parsing of :select option SQL, so I've tried another approach in an attempt to get core team support for this capability. The details are at http://dev.rubyonrails.org/ticket/7147#comment:12 but the key aspect is the use of the Symbol [] method to specify a list of attributes to be selected for each eager-loaded model: e.g. :include => {:books[:title, :stock, :price] => :author} I've tried to minimize the impact of defining a new method on a central class by forcing use of :symbol[] in any other context to either return a NoMethodError: undefined method `[]' for :symbol:Symbol or to make use of an already-defined Symbol [] method. Are their other dangers with such a definition that makes you uncomfortable? -- We develop, watch us RoR, in numbers too big to ignore. --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
