DEV Community

Margarita Potylitsyna
Margarita Potylitsyna

Posted on • Edited on

Devise with Ruby on Rails πŸ’‘

First of all create an ERD with https://ideas.firstdraft.com/

So here is what you have to do with freshly forked templates:

  • Add Devise to Your Gemfile gem "devise" if it's not already there.
  • In the terminal run Bundle install
  • Run rails generate devise:install
  • It will show you in the terminal what you should adjust in some of your files. Follow the instructions.
  • Only then run rails generate devise User
  • Then run rails db:create db:migrate (run just rails db:migrate if you already have tables in your database).
  • Create Devise views by running rails generate devise:views
  • Then you can follow Copilot and create the rest of your tables.
  • To protect your pages (authentication check) add this in controllers where you want users to be authenticated: before_action :authenticate_user!

It should work!

Top comments (0)