Skip to content

Overwrite default whitelisted search parameters

Andreas Dausenau edited this page Feb 1, 2025 · 1 revision

Overwrite default whitelisted search parameters

The EzOnRails::ResourceController will use all keys of your render info to permit the parameters you can pass for search actions.

This method can be overriden.

If you want to customize the permitted parameters in an EzOnRails::ResourceController you can override the public method search_params. This method must permit a q object holding the keys followed by the search methods.

...
def search_params
   params[:q]&.permit(:name_cont, :name_eq, :content_cont)
end
...

The default behavior of this method is to accept all keys that are returned by permit_render_info followed by every search matchers of ransack.

You can also change only the keys like described here.

Clone this wiki locally