Skip to content

Instantly share code, notes, and snippets.

@gugutz
Created March 31, 2019 22:41
Show Gist options
  • Save gugutz/e2346d6aacc46eb7cc6979c5327257d2 to your computer and use it in GitHub Desktop.
Save gugutz/e2346d6aacc46eb7cc6979c5327257d2 to your computer and use it in GitHub Desktop.
rails authentication with devise
updated: 31/03/2019 with rails 5.2
add `gem 'devise'` to gemfile
bundle install
rails g devise:install
Ensure you have defined default url options in your environments files. Open up config/environments/development.rb and add this line:
```config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }```
Ensure the default route is settled in config/routes, for instance:
```root to home#index```
Ensure to have flash messages in app/views/layouts/application.html.erb
```rails g devise user
rails db:migrate```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment