I try to create search with ransack. To do this, I need to check if nested parameters exist.
I get next params:
Parameters: {"q"=>{"category_id"=>"2", "name_cont"=>"test"}
How can I check if I get params [:category_id] or not?
If you're using Ruby >= 2.3.0, you can make use of Hash#dig
:
params.dig(:q, :category_id)