I tried putting the override in application_helper.rb and output some debug
statements to see the columns being processed.
def field_search_params_range_values(column)
puts "DEBUG: field_search_params_range for #{column.name}"
super
end
When clicking on the table Search, the log does not show any "date" columns.
I looked at AS source and the default date search operator is in
"lib/active_scaffold/bridges/shared/date_bridge.rb"
def active_scaffold_search_date_bridge(column, options)
current_search = {'from' => nil, 'to' => nil, 'opt' => 'BETWEEN',
'number' => 1, 'unit' => 'DAYS', 'range' => nil}
current_search.merge!(options[:value]) unless options[:value].nil?
tags = []
tags << active_scaffold_search_date_bridge_comparator_tag(column,
options, current_search)
tags << active_scaffold_search_date_bridge_trend_tag(column, options,
current_search)
tags << active_scaffold_search_date_bridge_numeric_tag(column, options,
current_search)
tags << active_scaffold_search_date_bridge_range_tag(column, options,
current_search)
tags.join(" ").html_safe
end
When I tried overriding this function, but it doesn't seem to do anything.
-Tin
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Sergio Cambra
> Sent: Monday, February 06, 2012 6:15 AM
> To: [email protected]
> Subject: Re: How to specify default search operator for field search?
>
> On Sábado, 4 de febrero de 2012 15:39:09 Tin Vo escribió:
> > Hello,
> >
> > I am currently using field search in my controllers. One of the
> field
> > search columns is a date field. The default search operator for date
> > is "Between". Is there a way to specify another default operator?
> >
> > -Tin
>
> Probably overriding field_search_params_range_values, this is the
> current code
>
> def field_search_params_range_values(column)
> values = field_search_params[column.name]
> return nil if values.nil?
> return values[:opt], (values[:from].blank? ? nil :
> values[:from]), (values[:to].blank? ? nil : values[:to])
> end
>
> --
> 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.
--
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.