1
我想使用cancan来允许更新模型的某个属性,但不允许其他属性。这是我的更新操作的样子。Cancan允许更新模型的特定属性
class UsersController < ApplicationController
load_and_authorize_resource
def update
respond_with User.update(params[:id], params[:user])
end
end
if resource.instance_of?教师
can [:read, :update], User do |user|
resource.users.include? user
end
我想老师能够修改user.course_id但没有别的。我该如何改变
can :update, User
要做我想做的事情。