Rails.application.routes.draw do locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do match 'book_setting' => "books#book_setting" ,as: :book_setting, via: [:get] resources :books do collection do get 'delete' get 'data_share' end match "add_author_type" => "books#add_author_type" ,as: :add_author_type, via: [:get, :post] match "edit_author_type" => "books#edit_author_type" ,as: :edit_author_type, via: [:get, :post] match "add_book_type" => "books#add_book_type" ,as: :add_book_type, via: [:get, :post] match "edit_book_type" => "books#edit_book_type" ,as: :edit_book_type, via: [:get, :post] end resources :book_author_types resources :book_types resources :book_intros end end end