field_select with search_ui = :select and "not"

24 views
Skip to first unread message

Atastor

unread,
Nov 24, 2011, 6:05:45 AM11/24/11
to actives...@googlegroups.com
Hi

how should I approach offering the possibility of negating a selection in a field_search form, where the column has search_ui = :select?

So just like in string-columns I would like to have a "not equal" operator. Using ":multiple => true"  is of course a possible workaround, but in my eyes less elegant.

Regards
Michael

ser...@entrecables.com

unread,
Nov 25, 2011, 3:46:18 AM11/25/11
to actives...@googlegroups.com
You will have to override conditions for that column in the controller.
https://github.com/activescaffold/active_scaffold/wiki/Search-Overrides

> --
> You received this message because you are subscribed to the Google
> Groups "ActiveScaffold : Ruby on Rails plugin" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/activescaffold/-/C1v0tcjhJoMJ [1].
> To post to this group, send email to actives...@googlegroups.com.
> To unsubscribe from this group, send email to
> activescaffol...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/activescaffold?hl=en.
>
>
> Links:
> ------
> [1] https://groups.google.com/d/msg/activescaffold/-/C1v0tcjhJoMJ

Atastor

unread,
Nov 29, 2011, 11:32:23 AM11/29/11
to actives...@googlegroups.com
I thought overriding the conditions just overrode the actual search conditions. 

What I was looking for was a simple way to insert a select field with the comparison operators just in front of the select field with the actual values. Just like the operator select fields which are inserted automatically with all the other search_uis (just not so with :select).

Regards
Michael

Sergio Cambra

unread,
Nov 30, 2011, 3:55:29 AM11/30/11
to actives...@googlegroups.com
On Martes, 29 de noviembre de 2011 08:32:23 Atastor escribió:
> I thought overriding the conditions just overrode the actual search
> conditions.
>

I understood you only need to override the search conditions.

> What I was looking for was a simple way to insert a select field with the
> comparison operators just in front of the select field with the actual
> values. Just like the operator select fields which are inserted
> automatically with all the other search_uis (just not so with :select).

You will have to override active_scaffold_search_select and include the
operators
def active_scaffold_search_select(column, html_options)
operators html code << super
end

Reply all
Reply to author
Forward
0 new messages