feat: add country filter to cities controller
- Introduce filtering of cities by selected country - Retrieve current country using friendly find method - Apply city filtering if country is provided in parameters This change allows users to efficiently filter cities based on the selected country, providing a more tailored experience and encouraging better navigation through the list of cities.
This commit is contained in:
parent
a1f1f2b728
commit
940f1a8f76
@ -15,6 +15,11 @@ class CitiesController < ApplicationController
|
||||
@cities = @cities.by_region(@current_region.id) if @current_region
|
||||
end
|
||||
|
||||
if params[:country]
|
||||
@current_country = Country.friendly.find(params[:country])
|
||||
@cities = @cities.by_country(@current_country.id) if @current_country
|
||||
end
|
||||
|
||||
@cities = @cities.page(params[:page]).per(12)
|
||||
|
||||
respond_to do |format|
|
||||
|
Loading…
Reference in New Issue
Block a user