Create a gist now

Instantly share code, notes, and snippets.

@Yama-to /devise.rb
Last active Aug 29, 2015

What would you like to do?
Railsでdeviseひとつで複数モデルを管理しよう ref: http://qiita.com/Yama-to/items/54ab4ce08e126ef7dade
config.scoped_views = true
$ rails g devise:install
Prefix Verb URI Pattern Controller#Action
#[--- 中略 ---]#
cancel_admin_registration GET /admins/cancel(.:format) admins/registrations#cancel
admin_registration POST /admins(.:format) admins/registrations#create
new_admin_registration GET /admins/sign_up(.:format) admins/registrations#new
edit_admin_registration GET /admins/edit(.:format) admins/registrations#edit
PATCH /admins(.:format) admins/registrations#update
PUT /admins(.:format) admins/registrations#update
DELETE /admins(.:format) admins/registrations#destroy
#[--- 中略 ---]#
cancel_user_registration GET /users/cancel(.:format) users/registrations#cancel
user_registration POST /users(.:format) users/registrations#create
new_user_registration GET /users/sign_up(.:format) users/registrations#new
edit_user_registration GET /users/edit(.:format) users/registrations#edit
PATCH /users(.:format) users/registrations#update
PUT /users(.:format) users/registrations#update
DELETE /users(.:format) users/registrations#destroy
#[--- 中略 ---]#
$ rails d devise:views
# invoke #Devise::Generators::SharedViewsGenerator
# remove app/views/devise/shared/_links.html.erb
# invoke form_for
# remove app/views/devise/confirmations/new.html.erb
# remove app/views/devise/passwords/edit.html.erb
# remove app/views/devise/passwords/new.html.erb
# remove app/views/devise/registrations/edit.html.erb
# remove app/views/devise/registrations/new.html.erb
# remove app/views/devise/sessions/new.html.erb
# remove app/views/devise/unlocks/new.html.erb
# invoke erb
# remove app/views/devise/mailer/confirmation_instructions.html.erb
# remove app/views/devise/mailer/reset_password_instructions.html.erb
# remove app/views/devise/mailer/unlock_instructions.html.erb
$ rails g devise user
$ rails g devise admin
$ rails g devise:controllers users
$ rails g devise:controllers admins
$ rails g devise:views users
$ rails g devise:views admins
Prefix Verb URI Pattern Controller#Action
#[--- 中略 ---]#
cancel_admin_registration GET /admins/cancel(.:format) devise/registrations#cancel
admin_registration POST /admins(.:format) devise/registrations#create
new_admin_registration GET /admins/sign_up(.:format) devise/registrations#new
edit_admin_registration GET /admins/edit(.:format) devise/registrations#edit
PATCH /admins(.:format) devise/registrations#update
PUT /admins(.:format) devise/registrations#update
DELETE /admins(.:format) devise/registrations#destroy
#[--- 中略 ---]#
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PATCH /users(.:format) devise/registrations#update
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
#[--- 中略 ---]#
devise_for :admins, controllers: {
sessions: 'admins/sessions',
passwords: 'admins/passwords',
registrations: 'admins/registrations'
}
devise_for :users, controllers: {
sessions: 'users/sessions',
passwords: 'users/passwords',
registrations: 'users/registrations'
}
Ruby: 2.1.3
Rails: 4.2.1
devise: 3.5.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment