ruby on rails - CanCan authorize all controllers -
i have cancan , rolify set activeadmin, , it's time force authorization on controllers.
do have authorize_resource
on every controller (we have couple dozen models , controllers now), or there way apply of activeadmin controllers?
i tried calling in before_filter activeadmin.setup, didn't work.
i made initializer: config/initializers/active_admin-cancan.rb
module activeadmin class resourcecontroller # if don't skip loading on #index exception: # # "collection not paginated scope. set collection.page(params[:page]).per(10) before calling :paginated_collection." load_resource :except => :index authorize_resource def scoped_collection end_of_association_chain.accessible_by(current_ability) end end end
borrowed user's code, can't find source more.
Comments
Post a Comment