LoginSignup
0
0

More than 3 years have passed since last update.

Railsでdeviseを導入する

Last updated at Posted at 2020-02-26

チラ裏レベルのなぐり書きを世に放って申し訳ない。

方法

$ vim Gemfile => gem "devise" を追加
$ bundle install
$ bundle exec rails g devise:install

以下を設定する。
===============================================================================
Some setup you must do manually if you haven't yet:

  1. Ensure you have defined default url options in your environments files. Here
     is an example of default_url_options appropriate for a development environment
     in config/environments/development.rb:

       config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

     In production, :host should be set to the actual host of your application.

  2. Ensure you have defined root_url to *something* in your config/routes.rb.
     For example:

       root to: "home#index"

  3. Ensure you have flash messages in app/views/layouts/application.html.erb.
     For example:

       <p class="notice"><%= notice %></p>
       <p class="alert"><%= alert %></p>

  4. You can copy Devise views (for customization) to your app by running:

       rails g devise:views
===============================================================================

設定後、

$ bundle exec rails g devise:views
$ bundle exec rails g devise Account

# 必要ならここでmigrationファイルにフィールドを加える

$ bundle exec rails db:migrate
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0