1、在GemFile添加:gem 'devise', '~> 4.2', '>= 4.2.1'
2、终端执行:bundle install
3、终端执行:rails generate devise:install
4、在/app/views/layouts/application.html.erb,添加:
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
5、在终端执行:rails g devise:views
6、终端执行:rails generate devise User
7、终端执行: rake db:migrate