DEV Community

hmza
hmza

Posted on

πŸ” Part 7 β€” Authentication & Authorization in Rails

πŸ” Part 7 β€” Authentication & Authorization in Rails

Use Devise:

 gem install devise rails generate devise:install rails generate devise User 
Enter fullscreen mode Exit fullscreen mode

Role-based access with Pundit:

 class PostPolicy < ApplicationPolicy def update? user.admin? || record.user == user end end 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)