On Miércoles, 30 de Septiembre de 2009 17:57:23 G. Sobrinho escribió: > But I want to use a select for association into fieldsearch. > > I can do it using a helper method and creating a select but I will need to > do it for all association which I want to use the :select.
If you want to use a select in search, set search_ui to :select, and search_sql to 'table.id'. config.columns[:association].search_sql = 'association_table.id' config.columns[:association].search_ui = :select > > 2009/9/30 Sergio Cambra .:: entreCables S.L. ::. <[email protected]> > > > On Martes, 29 de Septiembre de 2009 17:46:37 G. Sobrinho escribió: > > > But for all associations I will need to write a helper method to do it, > > > that's not dry. > > > > > > I think a good choice is the FieldSearch make a select tag for all > > > associations sending the id for search like search[seller_id]=1. > > > > > > > > > I remember when I started to use the AS I seed something like this but > > > I don't remember if this was a plugin or what. > > > > You only need to set form_ui (or search_ui if you want crud subform in > > create/update forms) to :select. > > > > > 2009/9/25 Sergio Cambra .:: entreCables S.L. ::. > > > <[email protected] > > > > > > > On Viernes, 25 de Septiembre de 2009 14:17:31 Sergio Cambra .:: > > > > entreCables > > > > > > > > S.L. ::. escribió: > > > > > On Jueves, 24 de Septiembre de 2009 22:10:52 G. Sobrinho escribió: > > > > > > Hello, > > > > > > > > > > > > I'm trying to use search to filter associations. I have Seller > > > > which > > > > > > > > has_many Announces. > > > > > > > > > > > > If I access the announces AS page and try to search 'webmotors' > > > > > > (it is > > > > > > > > a > > > > > > > > > > seller in my database) this doesn't find anything. Well, I tried > > > > > > to > > > > > > > > swap > > > > > > > > > > to FieldSearch but the associations aren't showed on search. > > > > > > > > > > > > > > > > > > AS is missing this feature, I'm doing something wrong or what is > > > > > > happening? > > > > > > > > > > Search is enabled by default only for real columns. You have to set > > > > > search_sql for associations in order to ActiveScaffold knows which > > > > > field > > > > > > > > of > > > > > > > > > the association table use to search. You have examples in API: > > > > > column > > > > > http://wiki.github.com/activescaffold/active_scaffold/api-column > > > > > > > > Also, you have to add the association to search columns > > > > http://wiki.github.com/activescaffold/active_scaffold/api-search > > > > With FieldSearch that's not needed. > > > > > > > > -- > > > > Sergio Cambra .:: entreCables S.L. ::. > > > > Mariana Pineda 23, 50.018 Zaragoza > > > > T) 902 021 404 F) 976 52 98 07 E) [email protected] > > > > -- > > Sergio Cambra .:: entreCables S.L. ::. > > Mariana Pineda 23, 50.018 Zaragoza > > T) 902 021 404 F) 976 52 98 07 E) [email protected] -- 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 -~----------~----~----~----~------~----~------~--~---
