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
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.