Rails.application.routes.draw do resources :measurements resources :readouts, only: [:new], path_names: {new: '/new(/:id/:scope)'}, constraints: {scope: /children|subtree|leaves/} do collection {get 'new/:id/discard', action: :discard, as: :discard} end resources :quantities, except: [:show], path_names: {new: '(/:id)/new'} do member { post :reparent } end resources :units, except: [:show], path_names: {new: '(/:id)/new'} do member { post :rebase } end namespace :default do resources :units, only: [:index, :destroy] do member { post :import, :export } #collection { post :import_all } end end # Devise does not handle properly models that require database access during loading. # https://github.com/heartcombo/devise/issues/5786 connection = ActiveRecord::Base.connection if connection.schema_version && connection.table_exists?(:users) devise_for :users, path: '', path_names: {registration: 'profile'}, controllers: {registrations: :registrations} end resources :users, only: [:index, :show, :update] do member { get :disguise } collection { get :revert } end unauthenticated do as :user do root to: redirect('/sign_in') end end root to: redirect('/units'), as: :user_root direct(:source_code) { 'https://gitea.michalczyk.pro/fixin.me/fixin.me' } direct(:issue_tracker) { 'https://gitea.michalczyk.pro/fixin.me/fixin.me/issues' } end