So in the past we had acts_as_authenticated, restful_authentication etc... But now there are a variety of options along with Rails itself having authentication functionality.
I'm about to start a new rails project and am interested in what everyone's preference (for non oAuth) authentication and what you would recommend I consider?
Thanks, Scott
Devise is a full-featured authentication solution which handles all of the controller logic and form views for you.
First, include the Devise gem in your Gemfile:
gem 'devise' 'version-if-u-want-any specific'
To install the newly-added gem, use:
bundle install
To install Devise, run:
rails g devise:install
and perform some settings manually, which are shown in the output of the command.
(Optional) For customization purposes, we can include the Devise gem's views in our app's views:
rails g devise:views
(Optional) Generate the user model, which will be used by Devise:
rails g devise user
Migrate your database:
rake db:migrate
You can see routes using:
rake routes
For signing up users, visit:
localhost:3000/users/sign_up
Use Devise it's the best gem for authentication. You will find plenty of tutorial and help on the web. When I started my first rails app I used it and it was really easy to install and get it working.
Devise on Github
Railscast on Devise
That should get you started but don't hesitate to read the devise wiki you should be able to get everything running pretty easily
You can take a look at https://www.ruby-toolbox.com/categories/rails_authentication
In my projects, I normally use devise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With