diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-11-16 23:36:41 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-11-16 23:36:41 +0530 |
commit | 2530d0eea8eaecd2c61f99225f050ff47973e9a0 (patch) | |
tree | e32d4920a21417e79584c6c7a563a2cb948b4532 /activerecord/test/models | |
parent | d9f460a39b73fd2cf0f17f523cc4810d0bf44cac (diff) | |
download | rails-2530d0eea8eaecd2c61f99225f050ff47973e9a0.tar.gz rails-2530d0eea8eaecd2c61f99225f050ff47973e9a0.tar.bz2 rails-2530d0eea8eaecd2c61f99225f050ff47973e9a0.zip |
Added default_scope to Base [#1381 state:committed] (Paweł Kondzior)
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/developer.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index c08476f728..0c20f97502 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -77,3 +77,15 @@ class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base raise if projects.empty? end end + +class DeveloperOrderedBySalary < ActiveRecord::Base + self.table_name = 'developers' + default_scope :order => "salary DESC" + + def self.all_ordered_by_name + with_scope(:find => { :order => "name DESC" }) do + find(:all) + end + end + +end |