Rails.application.routes.draw do locales = Site.first.in_use_locales rescue I18n.available_locales scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do resources :ruling_templates do member do get "upload_files" post "upload_image" get "get_temp_dir_name" delete "delete_image" end collection do post "change_image_order" post "upload_temp_file" end end end end end