Cancancan Ability on associations

11 views
Skip to first unread message

Corrado Tuccitto

unread,
Dec 15, 2022, 3:37:46 AM12/15/22
to cancancan
Hello please how could I be able to achieve  the following result written in pseudo code:
I Have a class

::Gri::Reports::Report has_many :gri_instances

::Gri::Instances::Instance has_many :compilers

What I wanna achieve is:
::Gri::Reports::Report will be visible only if current_user is included in compilers



if current_user.user?
      can [:read,:update], ::Gri::Reports::Report, gri_instances: { compilers: {id: current_user.id }}
end

thanks in advance
Reply all
Reply to author
Forward
0 new messages