searchable: refactor search_attributes helper methods into class.
Move the `search_attributes` helper methods inside the Searchable concern into a SearchContext helper class. This is so we don't have to pass `params` and `current_user` down through a bunch of different helper methods, and so that these private helper methods don't pollute the object's namespace.
This commit is contained in:
@@ -19,7 +19,7 @@ class SearchableTest < ActiveSupport::TestCase
|
||||
context "for a nonexistent attribute" do
|
||||
should "raise an error" do
|
||||
assert_raises(ArgumentError) do
|
||||
Post.search_attribute(:answer, 42, User.anonymous)
|
||||
Post.search_attributes({ answer: 42 }, :answer)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user