diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-09-07 13:08:03 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-18 20:49:19 +0200 |
commit | 9401fa0b9c89f51e3ec0f7aaeee7404b4a14ada8 (patch) | |
tree | a1e3b668a3de2c6c54a639839ec0d739a0e3757c /activerecord/test/models | |
parent | 8ae913664ff721e10dfc2c057998a38fd6f76edf (diff) | |
download | rails-9401fa0b9c89f51e3ec0f7aaeee7404b4a14ada8.tar.gz rails-9401fa0b9c89f51e3ec0f7aaeee7404b4a14ada8.tar.bz2 rails-9401fa0b9c89f51e3ec0f7aaeee7404b4a14ada8.zip |
expanding the test to include both type of order declaration
while declaring default_scope
Also added test for unscoped using block style with four different
combinations
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/car.rb | 11 | ||||
-rw-r--r-- | activerecord/test/models/engine.rb | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/activerecord/test/models/car.rb b/activerecord/test/models/car.rb index a1e351b54e..e7db3d3423 100644 --- a/activerecord/test/models/car.rb +++ b/activerecord/test/models/car.rb @@ -1,4 +1,5 @@ class Car < ActiveRecord::Base + has_many :bulbs has_many :tyres has_many :engines @@ -7,9 +8,15 @@ class Car < ActiveRecord::Base scope :incl_tyres, includes(:tyres) scope :incl_engines, includes(:engines) - default_scope :order => 'name desc' - scope :order_using_new_style, order('name asc') scope :order_using_old_style, :order => 'name asc' end + +class CoolCar < Car + default_scope :order => 'name desc' +end + +class FastCar < Car + default_scope order('name desc') +end diff --git a/activerecord/test/models/engine.rb b/activerecord/test/models/engine.rb index 751c3f02d1..851ff8c22b 100644 --- a/activerecord/test/models/engine.rb +++ b/activerecord/test/models/engine.rb @@ -1,3 +1,4 @@ class Engine < ActiveRecord::Base belongs_to :my_car, :class_name => 'Car', :foreign_key => 'car_id', :counter_cache => :engines_count end + |