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 post "space/add_floor", to: 'spaces#add_floor' post "space/update_floor", to: 'spaces#update_floor' post "space/create_floor_unit", to: 'spaces#create_floor_unit' get "spaces/:building_id/:floor_id/units", to: 'spaces#units' get "spaces/floor/:floor_id/add_floor_unit", to: 'spaces#add_floor_unit' get "spaces/floor/:floor_id/layout", to: 'spaces#floor_layout' delete "spaces/floor/:floor_id/delete", to: 'spaces#delete_floor' resources :spaces do get "floors" end end end end