This project is archived and is in readonly mode.

#2297 ✓resolved
Peter Wagenet

:through Associations don't respect default_scope

Reported by Peter Wagenet | March 19th, 2009 @ 02:11 PM | in 3.x

Consider the following case:


class Taggable < ActiveRecord::Base
  has_many :taggings
  has_many :tags, :through => :taggings
end

class Tagging < ActiveRecord::Base
  belongs_to :taggable
  belongs_to :tag

  default_scope :conditions => { :enabled => true }
end

class Tag < ActiveRecord::Base
  belongs_to :tagging
end

Tag.first.tags will entirely ignore the default_scope on Tagging.

I've included a patch which depends on other patch over at http://rails.lighthouseapp.com/p...

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages