Skip to content

Instantly share code, notes, and snippets.

@justintech
Created October 17, 2015 06:43
Show Gist options
  • Save justintech/db7bfa5b494d77b7ad2d to your computer and use it in GitHub Desktop.
Save justintech/db7bfa5b494d77b7ad2d to your computer and use it in GitHub Desktop.
Rails.application.routes.draw do
devise_for :admins, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :users, skip: [:sessions, :passwords, :registrations], controllers: { omniauth_callbacks: "callbacks", registrations: 'registrations', sessions: 'sessions' }
as :user do
# authentication
authenticated :user do
root to: 'items#index', as: :authenticated_root
end
unauthenticated :user do
root to: 'welcome#index', as: :unauthenticated_root
end
# sessions
post '/login', to: 'users/sessions#create', as: 'user_session'
get '/logout', to: 'users/sessions#destroy', as: 'destroy_user_session'
# registrations
get '/join', to: 'users/registrations#new', as: 'new_user_registration'
post '/join', to: 'users/registrations#create', as: 'user_registration'
# user accounts
scope '/account' do
# passwords
get '/reset-password', to: 'users/passwords#new', as: 'new_user_password'
get '/reset-password/change', to: 'users/passwords#edit', as: 'edit_user_password'
put '/reset-password', to: 'users/passwords#update', as: 'user_password'
post '/reset-password', to: 'users/passwords#create'
# settings & cancellation
get '/cancel', to: 'users/registrations#cancel', as: 'cancel_user_registration'
get '/settings', to: 'users/registrations#edit', as: 'edit_user_registration'
put '/settings', to: 'users/registrations#update'
# account deletion
delete '', to: 'users/registrations#destroy'
end
end
resources :categories
resources :reports
resources :messages
resources :conversations
resources :items do
collection do
get 'lost', to: 'items#index_lost'
get 'found', to: 'items#index_found'
get '/post/lost', to: 'items#new_lost'
get '/post/found', to: 'items#new_found'
end
get '/post/continue', to: 'items#continue', on: :member
end
resources :users, only: [ :profile, :items, :lost_items, :found_items ] do
get 'profile', to: 'users#profile'
get 'items', to: 'users#items'
get 'lost_items', to: 'users#lost_items'
get 'found_items', to: 'users#found_items'
end
get 'welcome/index'
get 'welcome/privacy'
get 'welcome/terms'
get 'welcome/disclaimer'
get 'welcome/how'
get 'welcome/help'
get 'welcome/about'
get 'welcome/massenger'
root to: 'welcome#index'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment