Ruby on rails 具有多个模型标准的专家

Ruby on rails 具有多个模型标准的专家,ruby-on-rails,pundit,Ruby On Rails,Pundit,当使用pundit时,我理解我可以授权当前用户使用模型。简单 我有一个场景,我希望根据一个模型授权用户,并在第二个模型中确认标准,但是Pundit只允许一个模型 i、 e 学生为他们的班级写文章,并且可以评论文章 Class has many students M:M Student has many classes M:M Class has many articles 1:M Article has many comments 1:M Student has many articles 1:

当使用pundit时,我理解我可以授权当前用户使用模型。简单

我有一个场景,我希望根据一个模型授权用户,并在第二个模型中确认标准,但是Pundit只允许一个模型

i、 e

学生为他们的班级写文章,并且可以评论文章

Class has many students M:M
Student has many classes M:M
Class has many articles 1:M
Article has many comments 1:M
Student has many articles 1:M
Student has many comments 1:M
在本文中,我需要授权:

Create action: Student is a member of the class
Destroy action: Student is member of class and is owner of article
Create action: Student is a member of class and article is not closed to comments
Destroy action: Student is member of class and is owner of article
在评论控制器中,我需要授权:

Create action: Student is a member of the class
Destroy action: Student is member of class and is owner of article
Create action: Student is a member of class and article is not closed to comments
Destroy action: Student is member of class and is owner of article
我希望在这里可以看到,当创建和销毁文章和评论时,我需要针对两种模型进行授权。始终为class_会员资格加上文章或评论

这可以做到在权威,因为我读它只能授权用户对一个模型