Skip to content
This repository has been archived by the owner on Mar 30, 2022. It is now read-only.

Increasing performance of checks method #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/meta_search/helpers/form_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,15 @@ 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)
check = MetaSearch::Check.new
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('_'),
Expand Down Expand Up @@ -163,4 +164,4 @@ def has_multiparameter_defaults?(args)
end
end
end
end
end
21 changes: 9 additions & 12 deletions meta_search.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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<shoulda>, [">= 0"])
s.add_runtime_dependency(%q<activerecord>, ["~> 3.1.0"])
s.add_runtime_dependency(%q<activesupport>, ["~> 3.1.0"])
s.add_runtime_dependency(%q<polyamorous>, ["~> 0.5.0"])
s.add_runtime_dependency(%q<actionpack>, ["~> 3.1.0"])
s.add_runtime_dependency(%q<activerecord>, ["~> 3.2.0"])
s.add_runtime_dependency(%q<activesupport>, ["~> 3.2.0"])
s.add_runtime_dependency(%q<actionpack>, ["~> 3.2.0"])
else
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<activerecord>, ["~> 3.1.0"])
s.add_dependency(%q<activesupport>, ["~> 3.1.0"])
s.add_dependency(%q<polyamorous>, ["~> 0.5.0"])
s.add_dependency(%q<actionpack>, ["~> 3.1.0"])
s.add_dependency(%q<activerecord>, ["~> 3.2.0"])
s.add_dependency(%q<activesupport>, ["~> 3.2.0"])
s.add_dependency(%q<actionpack>, ["~> 3.2.0"])
end
else
s.add_dependency(%q<shoulda>, [">= 0"])
s.add_dependency(%q<activerecord>, ["~> 3.1.0"])
s.add_dependency(%q<activesupport>, ["~> 3.1.0"])
s.add_dependency(%q<polyamorous>, ["~> 0.5.0"])
s.add_dependency(%q<actionpack>, ["~> 3.1.0"])
s.add_dependency(%q<activerecord>, ["~> 3.2.0"])
s.add_dependency(%q<activesupport>, ["~> 3.2.0"])
s.add_dependency(%q<actionpack>, ["~> 3.2.0"])
end
end