rails/rails — Issue #3890: Extension for a complex has_many :through
Author: ebrett
Created: 2011-12-07 14:01:50+00:00
State: open

I am converting a gem built for 2.3.11 to 3.1 and having difficulties with an extension:

has_many :actions, :class_name => 'Streamer::Model::Action', :through => :action_channel_entries, :order => 'actions.id desc' do

def subscriptions
proxy_association.owner.subscriptions
end
end

has_many :subscriptions, :class_name => 'Streamer::Model::ActionChannelSubscription'

Works for 2.3 but not for 3.1.3 - the self inside the extension in 2.3 is a named scope and it looks like in the documentation that for 3.1 it should now be a CollectionProxy - but when I run a test it is an ActiveRecord::Relation - which does not have a proxy_association. Any suggestions for what could be going on here?