I have the following type of resource routing:
resources :cities do
resources :restaurants
end
Which gives rise to the following type of routing:
/restaurants/:city_id/
In my restaurant index controller I have the usual ransack code, however when I click the search button I am redirected to /restaurants instead of /restaurants/:city_id.
How can I tweak ransack so when the search form is submitted it redirects to the url /restaurants/:city_id instead of /restaurants.
Thanks!
You can set manuel url
<%= search_form_for @q, url: city_restaurants_path(params[:city_id]) do |f| %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With