Rails 6 (and 5): User Accounts with 3 types of Roles – Devise, Rails Admin, CanCanCan

31-Aug-2020 2395
User accounts of several types are the common functionality of web applications. Ruby on Rails ecosystem provides several helpful gems: Devise for user authentication, CanCanCan for authorization, and RailsAdmin for admin panels.The following article has been moved here from codepany.com blog. The content was updated to the newest Ruby and Rails versions, but it’s still compatible with Rails 5 and Ruby 2.3.0.The article presents how to set up user accounts for two admin roles (superadmin, supervisor) and one end-user role. The admin roles grant access to the admin panel built with Rails Admin. Devise gem handles authentication, and CanCanCan gem does authorization.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle