Rails.application.routes.draw do Thread.new do patchfile_field = Patchfilefield.where(:title=>'patchfile').first if patchfile_field used_font = patchfile_field.used_font if used_font.present? File.open("app/assets/javascripts/ckeditor/custom_fonts.txt","w+") do |f| f.write(used_font.join(";")) end end end end locales = Site.first.in_use_locales rescue I18n.available_locales scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do get 'patchfiles' , to: 'patchfiles#index' get 'patchfiles/repair_module' , to: 'patchfiles#repair_module' get 'patchfiles/showckeditor' , to: 'patchfiles#showckeditor' get 'patchfiles/editckeditor' , to: 'patchfiles#editckeditor' get 'patchfiles/editfontfile' , to: 'patchfiles#editfontfile' post 'patchfiles/newfont' , to: 'patchfiles#newfont' get 'patchfiles/newfont' , to: 'patchfiles#newfont' patch 'patchfiles/newfont' , to: 'patchfiles#newfont' post 'patchfiles/edit' , to: 'patchfiles#edit' get 'patchfiles/edit' , to: 'patchfiles#edit' patch 'patchfiles/edit' , to: 'patchfiles#edit' resources :patchfiles end end end