The CanCan gem offers a straight forward and flexible way to define what a user can and cannot do.
CanCan is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access.
CanCan uses a model to define the abilities of a user. Inside the class you declare what a user can and cannot do by using the “can” method. From your controllers you use the "can?" method to test the current user's authorization.
As development on CanCan is no longer active, it has been continued on under the new name CanCanCan.