On Viernes, 31 de Julio de 2009 23:52:04 Seth Ladd escribió:
> Aloha Nick,
>
> Thanks, but that just controls the WHERE clause. I need to control
> the SELECT clause.
Use custom_finder_options (I don't know whether is documented in wiki):
def custom_finder_options
:select => 'foo, bar'
end
>
> Turns out this is *almost* really easy. All we need to do is this:
>
> def find_page_with_overrides(options = {})
> options.merge!(:select => 'foo, bar')
> find_page_without_overrides(options)
> end
>
> alias_method_chain :find_page, :overrides
>
> *except*
>
> That in find_page, the first line reads:
>
> def find_page(options = {})
>
> options.assert_valid_keys :sorting, :per_page, :page, :count_includes
>
> which prohibits the above from working. Bummer. I can of course
> add :select to the assert_valid_keys, but I'd rather not.
>
> On Jul 31, 11:48 am, Nick Rogers <[email protected]> wrote:
> > http://wiki.github.com/activescaffold/active_scaffold/api-list
> >
> > I think a conditions_for_collection method in your controller is what you
> > want.
> >
> > On Fri, Jul 31, 2009 at 2:40 PM, Seth <[email protected]> wrote:
> > > Aloha,
> > >
> > > We have a table with three large text fields. The standard SELECT *,
> > > which drives the list, is much too slow as it returns much too much
> > > data. We'd like to use ActiveRecord's :select option for find()
> > > inside find_page() (finder.rb)
> > >
> > > Is there any way to add arbitrary options to be passed in through
> > > find_page() and thus find() ? I can't see anything apparent, but I
> > > could easily be missing something.
> > >
> > > Otherwise, this appears to be a straightforward task, and if others
> > > find it useful I'd be happy to submit a patch.
> > >
> > > Thanks for your help,
> > > Seth
>
>
--
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---