diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2011-05-01 16:54:36 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2011-05-01 16:54:36 -0700 |
commit | 32ef3ccaa6beae4ef73969f51d5159f4cc4d9ff7 (patch) | |
tree | 2c6582f2aeadea6e72d362edb95d2cbd7934fb95 /activerecord/test/models | |
parent | 2db538c8a86d0a15d37d830179bce2452a1531b7 (diff) | |
parent | 5164c50d7ff42faa801e827dc8761ff11e61f3e2 (diff) | |
download | rails-32ef3ccaa6beae4ef73969f51d5159f4cc4d9ff7.tar.gz rails-32ef3ccaa6beae4ef73969f51d5159f4cc4d9ff7.tar.bz2 rails-32ef3ccaa6beae4ef73969f51d5159f4cc4d9ff7.zip |
Merge pull request #340 from joshk/default_scope_changes.
removed the default_scope deprecations and updated the docs and tests to
Diffstat (limited to 'activerecord/test/models')
-rw-r--r-- | activerecord/test/models/developer.rb | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb index 10701dd6fd..152f804e16 100644 --- a/activerecord/test/models/developer.rb +++ b/activerecord/test/models/developer.rb @@ -129,28 +129,40 @@ end class DeveloperCalledJamis < ActiveRecord::Base self.table_name = 'developers' + default_scope where(:name => 'Jamis') scope :poor, where('salary < 150000') end class PoorDeveloperCalledJamis < ActiveRecord::Base self.table_name = 'developers' + default_scope where(:name => 'Jamis', :salary => 50000) end class InheritedPoorDeveloperCalledJamis < DeveloperCalledJamis self.table_name = 'developers' - ActiveSupport::Deprecation.silence do - default_scope where(:salary => 50000) - end + default_scope where(:salary => 50000) end class MultiplePoorDeveloperCalledJamis < ActiveRecord::Base self.table_name = 'developers' + default_scope where(:name => 'Jamis') + default_scope where(:salary => 50000) +end - ActiveSupport::Deprecation.silence do - default_scope where(:salary => 50000) - end +module SalaryDefaultScope + extend ActiveSupport::Concern + + included { default_scope where(:salary => 50000) } end + +class ModuleIncludedPoorDeveloperCalledJamis < DeveloperCalledJamis + self.table_name = 'developers' + + include SalaryDefaultScope +end + + |