I have two related models such as this:
class PartCategory < ActiveRecord::Base
  has_many :part_types
  scope :engine, where(:name => ''Engine'')
end
class PartType < ActiveRecord::Base
  belongs_to :part_category
end
I would like to add a scope to the PartType model such as:
   scope :engine_parts, lambda { joins(:part_category).engine }
But when I try that, I get the following error:
NoMethodError: undefined method `default_scoped?'' for
ActiveRecord::Base:Class
	from /Users/bappelt/RubymineProjects/MyStreetMachine/idunno42!/ruby/
1.9.1/gems/activerecord-3.1.0/lib/active_record/base.rb:1082:in
`method_missing''
	from /Users/bappelt/RubymineProjects/MyStreetMachine/idunno42!/ruby/
1.9.1/gems/activerecord-3.1.0/lib/active_record/relation/
spawn_methods.rb:11:in `merge''
	from /Users/bappelt/RubymineProjects/MyStreetMachine/idunno42!/ruby/
1.9.1/gems/activerecord-3.1.0/lib/active_record/named_scope.rb:182:in
`block in scope''
	from (irb):1
	from /Users/bappelt/RubymineProjects/MyStreetMachine/idunno42!/ruby/
1.9.1/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in `start''
	from /Users/bappelt/RubymineProjects/MyStreetMachine/idunno42!/ruby/
1.9.1/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in `start''
	from /Users/bappelt/RubymineProjects/MyStreetMachine/idunno42!/ruby/
1.9.1/gems/railties-3.1.0/lib/rails/commands.rb:40:in `<top
(required)>''
	from script/rails:6:in `require''
	from script/rails:6:in `<main>''
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.
-- 
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.