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 resources :module_generators do get 'fields_setting' , to: 'module_generators#fields_setting' post 'update_fields_setting' , to: 'module_generators#update_fields_setting' patch 'update_fields_setting' , to: 'module_generators#update_fields_setting' get 'generate_module' , to: 'module_generators#generate_module' get 'copy' , to: 'module_generators#copy' get 'download' , to: 'module_generators#download' collection do post 'check_plugin_exist' ,to: 'module_generators#check_plugin_exist' post 'check_modal_name' ,to: 'module_generators#check_modal_name' end end end end end