2011-03-23 66 views
1

我不能得到這個規則是所有執行...它允許任何人去這個行動。幫助與鐵軌declarative_authorization

這裏是我的規則

role :student do 
    has_permission_on :relationships do 
     to :index 
     if_attribute :student_id=> is {user.student.id} 
    end 
    end 

我的繼承人控制器操作

class RelationshipsController < ApplicationController 

filter_resource_access :nested_in => :students 

def index 
    @guardians = @student.guardians 
    end 

我知道我有它正確設置導致此規則是工作的罰款

has_permission_on :students do 
     to :show 
     if_attribute :id => is {user.student.id} 
    end 

哪裏錯誤在我的規則定義?

請幫助

回答

0

很難考,但試試這個:

if_attribute :id=> is {user.student.id}