If you were following the excellent has_many :through blog, you may find you can’t use with_scope in the methods defined on your association. Instead, just send :with_scope along.
has_many :active_campaigns, :through => :campaign_distributions do
def <<(active_campaign)
CampaignDistribution.send(:with_scope, :create => {}) {
self.concat active_campaign
}
end
end
One Comment
Hello,
I tried to use this method. But, I can’t set the additional attribute in my join table.
Have you been able to make this work?