ActionView::Partials doesn't recognize not-yet-loaded HasManyThroughAssociationCollection


In User model:
  has_many :projects, :through => :authorizations

In view:
  render :partial => @user.projects

This blows up because HasManyThroughAssociation inherits from
AssociationProxy and not AssociationCollection.

Partial logic checks if @user.projects === AssociationCollection which
returns false.

Quick workaround is: render :partial => @user.projects.to_a

(actionpack/lib/action_view/partials.rb rev8129 line 122):

def render_partial(partial_path, object_assigns = nil, local_assigns
= nil) #:nodoc:
        case partial_path
        when Array, ActiveRecord::Associations::AssociationCollection

Should it be changed to "when Array,
ActiveRecord::Associations::AssociationProxy" or
HasManyThroughAssociation should inherit from AssociationCollection?

Isn't this ?

Yup, somehow didn't stumble upon that.