Skip to content
Browse files

Added configuration settings for ignore_parameters

  • Loading branch information...
1 parent a2c3f7e commit 5e3dfc62a1276a955fdaee5dafad7f8a4c7520a3 @benedikt committed Dec 9, 2010
Showing with 8 additions and 1 deletion.
  1. +2 −0 README.rdoc
  2. +4 −0 lib/filter_fu.rb
  3. +2 −1 lib/filter_fu/view_helper.rb
View
2 README.rdoc
@@ -72,7 +72,9 @@ If you wish to explicitly exclude some you can do this by passing an array as :i
# f is a ActionView::Helpers::FormBuilder
<% end %>
+It's possible to add default values for <tt>:ignore_parameters</tt>. Simply add something like this to your initializers:
+ config.filter_fu.ignore_parameters = [:param_to_ignore]
== Known issues
View
4 lib/filter_fu.rb
@@ -2,7 +2,11 @@
require 'filter_fu/view_helper'
module FilterFu
+ mattr_accessor :ignore_parameters
+ @@ignore_parameters = []
+
class Railtie < Rails::Railtie
+ config.filter_fu = FilterFu
initializer "filter_fu.initialize" do |app|
::ActiveRecord::Base.send :include, FilterFu::ActiveRecord if defined? ::ActiveRecord::Base
View
3 lib/filter_fu/view_helper.rb
@@ -26,7 +26,8 @@ def filter_form_for(*args, &block)
name = (args.first || :filter).to_sym
opts[:ignore_parameters] ||= []
- opts[:ignore_parameters] += [:controller, :action, name]
+ opts[:ignore_parameters] += FilterFu.ignore_parameters + [:controller, :action, name]
+ opts[:ignore_parameters].uniq!
opts[:html] ||= {}
opts[:html][:method] ||= :get

0 comments on commit 5e3dfc6

Please sign in to comment.
Something went wrong with that request. Please try again.