On Lunes, 6 de febrero de 2012 11:30:54 Tin Vo escribió:
> 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("&nbsp;").html_safe
>   end
> 
> When I tried overriding this function, but it doesn't seem to do anything.

You are right.
active_scaffold_search_date_bridge sets defaults in current_search hash, and 
then merge options[:value]
options[:value] is result from field_search_params, which is a controller 
method added as helper_method, so overriding it in the controller should work:

    def field_search_params
      search_params || {:opt => 'default opt'}
    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.

Reply via email to