Skip to content

Enforce CanCan constraints

koenhandekyn edited this page Mar 5, 2012 · 1 revision

enforce constraints set at cancan level, for example this cascaded restriction:

can :manage, LicensePlate, :lessee => { :owner_id => user.owner_id }

will be enforced by adding this to the activeadmin configuration of your model to

controller do
  load_and_authorize_resource :except => :index
    def scoped_collection
      end_of_association_chain.accessible_by(current_ability)
    end
 end
Clone this wiki locally