我想我说得对。。。
class Asset < ActiveRecord::Base
belongs_to :assetable, :polymorphic => true
...
end
我有一个作为作用域的类级方法:
def self.some_scope
assets = Asset.joins(:assetable).where('assetable.approved_at IS NOT NULL').order('assetable.approved_at DESC').limit(50)
end
我想得到一份父母的资产清单
approved_at
批准
属性的降序,限制为50。我承认,我不确定自己有多接近正确,但我现在得到的错误是:
"Can not eagerly load the polymorphic association :assetable"