我正在使用声明式授权来管理应用程序中的用户权限。
我有一个帖子模型,它的所有者可以管理它。
has_permission_on :post, :to => :manage do
if_attribute :creator_id => is{user.id}
end
但是,我的模型中也有以下内容:
class Post < ActiveRecord::Base
def publish!
update_attributes(:published, true)
end
end
我想允许一些不是帖子创建者的用户发布它。
我不能只允许他们更新对象,他们不应该能够更改发布状态以外的其他字段。
不过,似乎没有办法只允许编辑模型中的某些字段。