How to order by an attribute of a parent for a polymorphic model in ActiveRecord?
I think I worded that correctly...

I have a model called asset which is polymorphic:

    class Asset < ActiveRecord::Base
      belongs_to :assetable, :polymorphic => true
    ...
    end

I have a class level method that acts as a scope:

    def self.some_scope
         assets = Asset.joins(:assetable).where('assetable.approved_at IS NOT NULL').order('assetable.approved_at DESC').limit(50)
    end

I am trying to get a list of assets who's parent's `approved_at` attribute is not null and order by that `approved_at` attribute in descending order with a limit of 50.  I'll admit that I'm not sure how close what I have is to being correct but the error I am getting now is:

    "Can not eagerly load the polymorphic association :assetable"


How to order by an attribute of a parent for a polymorphic model in ActiveRecord?
===

I think I worded that correctly...

I have a model called asset which is polymorphic:

    class Asset < ActiveRecord::Base
      belongs_to :assetable, :polymorphic => true
    ...
    end

I have a class level method that acts as a scope:

    def self.some_scope
         assets = Asset.joins(:assetable).where('assetable.approved_at IS NOT NULL').order('assetable.approved_at DESC').limit(50)
    end

I am trying to get a list of assets who's parent's `approved_at` attribute is not null and order by that `approved_at` attribute in descending order with a limit of 50.  I'll admit that I'm not sure how close what I have is to being correct but the error I am getting now is:

    "Can not eagerly load the polymorphic association :assetable"

