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

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

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

class Tag < ActiveRecord::Base
  belongs_to :tagging

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

I've included a patch which depends on other patch over at

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=""></a>