diff options
author | Tom Stuart <tom@experthuman.com> | 2008-11-17 20:10:59 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-11-17 22:00:14 +0100 |
commit | 32cb2345a54b9ab38461b2d4bb0dbd1706f2800e (patch) | |
tree | 9da1d7efd04f2f589c777699e2d3c6274820d4be /activerecord/test/models | |
parent | 3a33ee28e9babc5a1a78079f5ca50ea6249f2643 (diff) | |
download | rails-32cb2345a54b9ab38461b2d4bb0dbd1706f2800e.tar.gz rails-32cb2345a54b9ab38461b2d4bb0dbd1706f2800e.tar.bz2 rails-32cb2345a54b9ab38461b2d4bb0dbd1706f2800e.zip |
Fix default_scope to work in combination with named scopes
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/developer.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index 0c20f97502..92039a4f54 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -79,13 +79,13 @@ class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base end class DeveloperOrderedBySalary < ActiveRecord::Base - self.table_name = 'developers' - default_scope :order => "salary DESC" + self.table_name = 'developers' + default_scope :order => 'salary DESC' + named_scope :by_name, :order => 'name DESC' - def self.all_ordered_by_name - with_scope(:find => { :order => "name DESC" }) do - find(:all) - end + def self.all_ordered_by_name + with_scope(:find => { :order => 'name DESC' }) do + find(:all) end - + end end |