Skip to content

Instantly share code, notes, and snippets.

@lin
Last active August 25, 2020 20:57
Show Gist options
  • Select an option

  • Save lin/90e6ae0aa80927c2120f to your computer and use it in GitHub Desktop.

Select an option

Save lin/90e6ae0aa80927c2120f to your computer and use it in GitHub Desktop.
Rails Basic
devise_for :people, skip: [:sessions, :passwords, :confirmations, :registrations]
as :person do
# session handling
get '/login' => 'devise/sessions#new', as: 'new_person_session'
post '/login' => 'devise/sessions#create', as: 'person_session'
delete '/logout' => 'devise/sessions#destroy', as: 'destroy_person_session'
# joining
get '/join' => 'devise/registrations#new', as: 'new_person_registration'
post '/join' => 'devise/registrations#create', as: 'person_registration'
scope '/account' do
# password reset
get '/reset-password' => 'devise/passwords#new', as: 'new_person_password'
put '/reset-password' => 'devise/passwords#update', as: 'person_password'
post '/reset-password' => 'devise/passwords#create'
get '/reset-password/change' => 'devise/passwords#edit', as: 'edit_person_password'
# confirmation
get '/confirm' => 'devise/confirmations#show', as: 'person_confirmation'
post '/confirm' => 'devise/confirmations#create'
get '/confirm/resend' => 'devise/confirmations#new', as: 'new_person_confirmation'
# settings & cancellation
get '/cancel' => 'devise/registrations#cancel', as: 'cancel_person_registration'
get '/settings' => 'devise/registrations#edit', as: 'edit_person_registration'
put '/settings' => 'devise/registrations#update'
# account deletion
delete '' => 'devise/registrations#destroy'
end
end
helper_method :current_user, :logged_in?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment