Rails Setup

Rails Setup

  • Rails
  • Devise
  • GitHub

›Guides

General

  • Overview
  • Starting with rails?

Getting Started

  • Installation
  • Controller filters and helpers
  • Configuring Models
  • Strong Parameters
  • Configuring views
  • Configuring controllers
  • Configuring routes

Advanced Topics

  • I18n
  • Test helpers
  • OmniAuth
  • Configuring multiple models
  • ActiveJob integration
  • Password reset tokens and Rails logs
  • Other ORMs
  • Rails API mode

Guides

  • Guides list

Project

  • Extensions
  • Example Applications
  • Contributing
  • Bug reports
  • Additional information

Guides list

Todo: move the guides to this site

Feel free to add your own how-to and categorize it in this list.

Upgrading

  • Upgrade: General Instructions
  • Upgrade to Devise 3.1
  • Upgrade to Devise 2.2
  • Upgrade to Devise 2.1
  • Upgrade to Devise 2.0
  • Upgrade to Devise 2.0 migration schema style
  • Migration legacy database

Workflow Customization

  • Automatically generate password for users (simpler registration)
  • Change the default sign_in and sign_out routes
  • Change Default Sign_up Registration Path with Custom Path
  • Customize routes to user registration pages
  • Redirect to a specific page on successful sign in out
  • Customize the redirect after a user edits their profile
  • Customize the redirect path after destroying a session (signing out)
  • Override confirmations so users can pick their own passwords as part of confirmation activation
  • Retain User Data after account Delete (soft delete)
  • Use Omniauth in a localized scope
  • Redirect with locale after authentication failure
  • Require admin to activate account before sign_in
  • Set up devise as a single user system
  • Two step confirmation
  • Redirect back to current page after sign in, sign out, sign up, update
  • Redirect from HTTPS to HTTP on successful sign out
  • Redirect to a specific page on successful sign in, sign up, or sign out
  • Redirect to a specific page when the user can not be authenticated
  • Do not redirect to login page after session timeout
  • Create a guest user
  • Allow users to edit their password
  • Require authentication for all pages and avoid "You need to sign in..." message when hitting the application root
  • Use a custom email validator with Devise
  • Notify users via email when their passwords change
  • Customize minimum password length

View/Content Customization

  • Create custom layouts
  • Custom mailer
  • I18n
  • Set :host and :port for all devise mailer urls
  • Override devise_error_messages! for use in views
  • Integrate I18n Flash Messages with Devise and Bootstrap
  • I18n Messages for Scoped Resources
  • Add sign_in, sign_out, and sign_up links to your layout template

Custom Authentication Methods

  • Allow users to sign in with something other than their email address
  • Authenticate via LDAP
  • Create a guest user
  • Email-only sign-up
  • Edit an account without providing a password
  • HTTP Authentication
  • HTTP Auth Basic
  • Recaptcha
  • Remote authentication with Devise
  • Set up devise as a single user system
  • Sign in using either a username or email address
  • Simple Token Authentication Example
  • Use case insensitive emails
  • Use SSL (HTTPS)
  • Use subdomains
  • AWS Cognito Federated Identity Authentication Example

OmniAuth

  • OmniAuth: Overview
  • OmniAuth: Testing
  • Omniauthable, sign out action and rememberable

Testing

  • Capybara
  • Controller tests with Rails (and RSpec)
  • Cucumber
  • OmniAuth: Testing
  • Rspec with devise and machinist
  • Speed up your unit tests
  • Stub authentication in controller specs

Privileges/Authorization

  • Add an Admin role
  • Add a default role to a User
  • Create a guest user
  • Integrate with CanCan for roles management
  • Manage Users with an Admin Role (CanCan method)
  • Require admin to activate account before sign_in
  • Sign in as another user if you are an admin
  • Turn off trackable for admin users

Special Configurations

  • Add :confirmable to Users
  • Add :lockable to Users
  • Create a custom encryptor
  • Create Haml and Slim Views
  • Configure a master password
  • Customize user account status validation when logging in
  • Disable user from destroying their account
  • Disallow previously used passwords
  • Dynamic user registration timeout
  • Embed users in your account model with Mongoid
  • Protect Resque Web with Devise
  • Send emails from subdomains
  • Send emails in background (Resque, Sidekiq and Delayed::Job)
  • Using paranoid mode, avoid user enumeration on registerable
  • Use Devise Inside a Mountable Engine

Elsewhere in your App

  • Add sign_in, sign_out, and sign_up links to your layout template
  • Display a custom sign_in form anywhere in your app
  • Sign in from a controller
  • Use Devise generated method and filters for controllers
  • Find a user when you have their credentials
  • Make Devise work with other formats like mobile, iPhone and iPad (Rails specific)
  • Manage users through a CRUD interface
  • Mass password reset and email notification

JavaScript

  • Use with BackboneJS models

Migrating from other authentication plugins

  • Migrate from restful_authentication to Devise
  • Add devise required columns to an existing users table
Last updated on 2019-7-7
← Rails API modeExtensions →
  • Upgrading
  • Workflow Customization
  • View/Content Customization
  • Custom Authentication Methods
    • OmniAuth
  • Testing
  • Privileges/Authorization
  • Special Configurations
  • Elsewhere in your App
  • JavaScript
  • Migrating from other authentication plugins
Rails Setup 2019