2010-06-27 15:17:44 +00:00
|
|
|
class Car < ActiveRecord::Base
|
2010-09-07 17:08:03 +00:00
|
|
|
|
2010-08-13 01:37:48 +00:00
|
|
|
has_many :bulbs
|
2011-04-03 23:07:45 +00:00
|
|
|
has_many :foo_bulbs, :class_name => "Bulb", :conditions => { :name => 'foo' }
|
2011-05-10 22:35:01 +00:00
|
|
|
has_many :frickinawesome_bulbs, :class_name => "Bulb", :conditions => { :frickinawesome => true }
|
|
|
|
|
2010-08-03 21:26:59 +00:00
|
|
|
has_many :tyres
|
2010-06-27 15:17:44 +00:00
|
|
|
has_many :engines
|
|
|
|
has_many :wheels, :as => :wheelable
|
2010-08-03 21:26:59 +00:00
|
|
|
|
|
|
|
scope :incl_tyres, includes(:tyres)
|
|
|
|
scope :incl_engines, includes(:engines)
|
|
|
|
|
2010-09-01 16:04:29 +00:00
|
|
|
scope :order_using_new_style, order('name asc')
|
|
|
|
scope :order_using_old_style, :order => 'name asc'
|
|
|
|
|
2010-06-27 15:17:44 +00:00
|
|
|
end
|
2010-09-07 17:08:03 +00:00
|
|
|
|
|
|
|
class CoolCar < Car
|
2011-04-18 22:15:38 +00:00
|
|
|
default_scope :order => 'name desc'
|
2010-09-07 17:08:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
class FastCar < Car
|
2011-04-18 22:15:38 +00:00
|
|
|
default_scope :order => 'name desc'
|
2010-09-07 17:08:03 +00:00
|
|
|
end
|