title: Using a scope from a related model in another scope
body: <p>I have two related models such as this: </p>
  
  <pre><code>class PartCategory &lt; ActiveRecord::Base 
    has_many :part_types 
    scope :engine, where(:name =&gt; 'Engine') 
  end 
  
  class PartType &lt; ActiveRecord::Base 
    belongs_to :part_category 
  end 
  </code></pre>
  
  <p>I would like to add a scope to the PartType model such as: </p>
  
  <pre><code>scope :engine_parts, lambda { joins(:part_category).engine } 
  </code></pre>
  
  <p>But when I try that, I get the following error: </p>
  
  <p>NoMethodError: undefined method `default_scoped?' for ActiveRecord::Base:Class </p>
  
  <p>I don't have a lot of experience with the scope thing, so I am probably missing something fundamental here. Can someone please tell me what it is. </p>