【发布时间】:2011-10-17 02:20:52
【问题描述】:
我使用 CanCan load_and_authorize_resource 辅助方法来获取资源和生成授权,但我有一个这样的嵌套资源
load_and_authorize_resource :company
load_and_authorize_resource :accountings, :through => :company, :class => 'Departments::Accounting'
但我需要 @accountings 由另一个属性而不是 Departmets::Accounting id 找到,并为该属性赋值,例如
@accountings = @company.find_by_period_id(@period.id)
【问题讨论】: