Rails.application.routes.draw do locales = Site.first.in_use_locales rescue I18n.available_locales namespace :admin do resources :ruling_weathers do member do get "edit_setting" post "update_setting" patch "update_setting" end collection do get "new_setting" post "create_setting" patch "create_setting" end end end scope "(:locale)", locale: Regexp.new(locales.join("|")) do post "/xhr/ruling_weather/get_weather_info" => "ruling_weathers#get_weather_info" get "/xhr/ruling_weather/get_weather_info" => "ruling_weathers#get_weather_info" end end