Skip to content

Commit

Permalink
Do not freeze common_search_filter_includes
Browse files Browse the repository at this point in the history
That way we can add more custom filters to the search without overwriting the method
  • Loading branch information
tvdeyen committed Jul 17, 2020
1 parent 5c63658 commit af6e054
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/alchemy/admin/resources_controller.rb
Expand Up @@ -148,15 +148,15 @@ def search_filter_params

def common_search_filter_includes
[
{q: [
{ q: [
resource_handler.search_field_name,
:s,
]},
] },
:tagged_with,
:filter,
:page,
:per_page,
].freeze
]
end

def items_per_page
Expand Down
10 changes: 10 additions & 0 deletions spec/controllers/alchemy/admin/resources_controller_spec.rb
Expand Up @@ -149,4 +149,14 @@ def resource_handler
end
end
end

describe "#common_search_filter_includes" do
before do
allow(controller).to receive(:alchemy_module) { { name: "events" } }
end

it "should not be frozen" do
expect(controller.send(:common_search_filter_includes)).to_not be_frozen
end
end
end

0 comments on commit af6e054

Please sign in to comment.