我有两个模型:
Thread (id, title)
ThreadParticipation (id, thread_id, user_id)
我想定义类似:
can :create, ThreadParticipation if the user is a ThreadParticipation
例子:
for
thread: (1, 'hello world')
thread_participation: (313, 1, 13) -- where 13 is the user_id
我试过了:
can :create, ThreadParticipation, :thread_participations => { :user_id => current_user.id }
但是那个错误。有任何想法吗?