2010-06-27 11:17:44 -04:00
|
|
|
class Car < ActiveRecord::Base
|
2010-09-07 13:08:03 -04:00
|
|
|
|
2010-08-12 21:37:48 -04:00
|
|
|
has_many :bulbs
|
2010-08-03 17:26:59 -04:00
|
|
|
has_many :tyres
|
2010-06-27 11:17:44 -04:00
|
|
|
has_many :engines
|
|
|
|
has_many :wheels, :as => :wheelable
|
2010-08-03 17:26:59 -04:00
|
|
|
|
|
|
|
scope :incl_tyres, includes(:tyres)
|
|
|
|
scope :incl_engines, includes(:engines)
|
|
|
|
|
2010-09-01 12:04:29 -04:00
|
|
|
scope :order_using_new_style, order('name asc')
|
|
|
|
scope :order_using_old_style, :order => 'name asc'
|
|
|
|
|
2010-06-27 11:17:44 -04:00
|
|
|
end
|
2010-09-07 13:08:03 -04:00
|
|
|
|
|
|
|
class CoolCar < Car
|
|
|
|
default_scope :order => 'name desc'
|
|
|
|
end
|
|
|
|
|
|
|
|
class FastCar < Car
|
|
|
|
default_scope order('name desc')
|
|
|
|
end
|