diff --git a/lib/meta_search/helpers/form_builder.rb b/lib/meta_search/helpers/form_builder.rb index 944da5e..942ad9e 100644 --- a/lib/meta_search/helpers/form_builder.rb +++ b/lib/meta_search/helpers/form_builder.rb @@ -120,6 +120,7 @@ def checks(method, choices = [], options = {}, &block) # <% end %> def collection_checks(method, collection, value_method, text_method, options = {}, &block) check_boxes = [] + current_searches = [@object.send(method)].flatten collection.each do |choice| text = choice.send(text_method) value = choice.send(value_method) @@ -127,7 +128,7 @@ def collection_checks(method, collection, value_method, text_method, options = { check.box = @template.check_box_tag( "#{@object_name}[#{method}][]", value, - [@object.send(method)].flatten.include?(value), + current_searches.include?(value), options.merge(:id => [@object_name, method.to_s, value.to_s.underscore].join('_')) ) check.label = @template.label_tag([@object_name, method.to_s, value.to_s.underscore].join('_'), @@ -163,4 +164,4 @@ def has_multiparameter_defaults?(args) end end end -end \ No newline at end of file +end diff --git a/meta_search.gemspec b/meta_search.gemspec index 737e555..a73899f 100644 --- a/meta_search.gemspec +++ b/meta_search.gemspec @@ -67,23 +67,20 @@ Gem::Specification.new do |s| if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_development_dependency(%q, [">= 0"]) - s.add_runtime_dependency(%q, ["~> 3.1.0"]) - s.add_runtime_dependency(%q, ["~> 3.1.0"]) - s.add_runtime_dependency(%q, ["~> 0.5.0"]) - s.add_runtime_dependency(%q, ["~> 3.1.0"]) + s.add_runtime_dependency(%q, ["~> 3.2.0"]) + s.add_runtime_dependency(%q, ["~> 3.2.0"]) + s.add_runtime_dependency(%q, ["~> 3.2.0"]) else s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 3.1.0"]) - s.add_dependency(%q, ["~> 3.1.0"]) - s.add_dependency(%q, ["~> 0.5.0"]) - s.add_dependency(%q, ["~> 3.1.0"]) + s.add_dependency(%q, ["~> 3.2.0"]) + s.add_dependency(%q, ["~> 3.2.0"]) + s.add_dependency(%q, ["~> 3.2.0"]) end else s.add_dependency(%q, [">= 0"]) - s.add_dependency(%q, ["~> 3.1.0"]) - s.add_dependency(%q, ["~> 3.1.0"]) - s.add_dependency(%q, ["~> 0.5.0"]) - s.add_dependency(%q, ["~> 3.1.0"]) + s.add_dependency(%q, ["~> 3.2.0"]) + s.add_dependency(%q, ["~> 3.2.0"]) + s.add_dependency(%q, ["~> 3.2.0"]) end end