Pundit is an authorization library for Ruby applications that uses plain Ruby objects to define access policies. It provides a simple, object-oriented approach to authorization where each model has a corresponding policy class containing authorization logic. Unlike role-based systems, Pundit focuses on resource-based authorization, letting you define who can perform which actions on specific objects. The gem integrates cleanly with Rails controllers and views without requiring extensive configuration or DSLs.
gem install pundit Run this gem instantly in your browser without any installation:
Open in RunRuby.dev →