我的模型设置为
Film :has_many :sections
Section :belongs_to :film在我的authorization_rules.rb中我有
role :author do
has_permission_on :films, :to => [:edit. :update] do
if_attribute :user => is {user}
end
end这在编辑胶片时工作得很好,因为他们是胶片中的user_id字段。
我可以在has-permission-on do块中嵌套:节的规则吗?在部分中没有user_id,我不想添加一个,因为如果部分belongs_to一个电影已经有一个,它似乎是多余的。
发布于 2009-12-17 05:47:08
是的,你可以嵌套它们,
has_permission_on [:films], :to => [ :edit, :update] do
if_attribute :user => is {user}
has_permission_on :sections, :to => [:update, :edit]
endhttps://stackoverflow.com/questions/1915582
复制相似问题