I have the following Ability:
Ability
can :manage, ActiveAdmin::Page, name: 'My Page'
And it works fine, but I want to check if the user has the ability to manage this ActiveAdmin::Pageon different pages. Therefore, when I used the following:
ActiveAdmin::Page
can? :manage, ActiveAdmin::Page, name: 'My Page'
He returned truefor any page, even if it does not exist!
true
Finally, I figured out the way, it looks weird because it uses register_page, but it works:
can? :manage, (ActiveAdmin::register_page 'My Page')
The code
, ActiveAdmin::Page, name My Page. , , true.
name
, (, , ), : " ?" " " "?". , .
CanCan, , :
can? :manage, my_specific_page
my_specific_page ActiveAdmin::Page.
my_specific_page
Source: https://habr.com/ru/post/1667751/More articles:MySQL sequential group - sqlUsing (templated) overloaded functions to prevent common arithmetic conversions - c ++Mutable Member in ConstExpr object in C ++ 11 - c ++RxJava1 vs Rxjava2: An exception in onNext - rx-javaCan we inherit and change noupdate = "1" in an ode? - inheritanceSpring Security OAuth2 AngularJSКак я могу переписать хеш пароля, сделанный SHA1 (в ASP.NET Identity)? - c#CSS/JavaScript - Добавление состояния фокусировки при зависании элемента - javascriptC # - convert object to brush (WPF) - c #'Property' serviceData 'does not exist in type' GeoService '.' Typescript Angular2 - angularAll Articles