So far, the cleanest method I have for accomplishing this: 1) set the column as [:user_id], NOT as an associated column ([:user]) 2) override the user_id_column helper to display the link 3) add a class to the user_id column to force left justification
This keeps AS from executing the additional query. Alan On Jul 13, 3:34 pm, Alan <[email protected]> wrote: > My active scaffold controller utilizes custom_finder_options and joins > to for the list action. It has an association for "user", which I have > set up for a show link when clicked on in the AS list. > > My main list query already retrieves user_id, users.first_name, > users.last_name, so I have that data available. However, an extra > query gets executed for this association: > SELECT `users`.* FROM `users` WHERE SELECT `users`.* FROM `users` > WHERE (`users`.`id` IN (12,20,10)) > > I realize this is a query for eager loading, but it is unneeded. I > have tried disabling eager loading by setting "includes = nil", but it > still makes a query for each individual record. I want to completely > disable this extra query and have my users_column helper just display > the first_name + last_name. > > What is the best way to approach this? > I have disabled eager loading and found out where to conditionally > omit this, but it is a mess. Is there a configuration option or a > cleaner/simpler way to override a method to disable any querying on an > associated model? -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.
