diff options
author | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-28 18:46:26 +0200 |
---|---|---|
committer | Josh Kalderimis <josh.kalderimis@gmail.com> | 2011-04-28 18:46:40 +0200 |
commit | 5164c50d7ff42faa801e827dc8761ff11e61f3e2 (patch) | |
tree | 018275033ea24df6f16724768e035719e51dc0f6 /activerecord/test/models | |
parent | bb44cd727ff4df0c6baac52ec008289626b874e9 (diff) | |
download | rails-5164c50d7ff42faa801e827dc8761ff11e61f3e2.tar.gz rails-5164c50d7ff42faa801e827dc8761ff11e61f3e2.tar.bz2 rails-5164c50d7ff42faa801e827dc8761ff11e61f3e2.zip |
removed the default_scope deprecations and updated the docs and tests to reflect its use cases
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 + + |