diff options
author | Nikita Afanasenko <nikita@afanasenko.name> | 2012-10-29 19:22:59 +0400 |
---|---|---|
committer | Nikita Afanasenko <nikita@afanasenko.name> | 2012-10-29 19:22:59 +0400 |
commit | 0b7067d8497c4d832b32233888ce973ab4357e5d (patch) | |
tree | 036be2c4e07d30287498a8de215550330039a176 /activerecord/lib/active_record/scoping | |
parent | 29b1dc273e1ad6b9e13bf48fe3f12047850f9554 (diff) | |
download | rails-0b7067d8497c4d832b32233888ce973ab4357e5d.tar.gz rails-0b7067d8497c4d832b32233888ce973ab4357e5d.tar.bz2 rails-0b7067d8497c4d832b32233888ce973ab4357e5d.zip |
Provide a call stack for deprecation warnings where needed.
It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
Diffstat (limited to 'activerecord/lib/active_record/scoping')
-rw-r--r-- | activerecord/lib/active_record/scoping/default.rb | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/scoping/named.rb | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb index 6835d0e01b..705b719a3a 100644 --- a/activerecord/lib/active_record/scoping/default.rb +++ b/activerecord/lib/active_record/scoping/default.rb @@ -95,7 +95,8 @@ module ActiveRecord "Calling #default_scope without a block is deprecated. For example instead " \ "of `default_scope where(color: 'red')`, please use " \ "`default_scope { where(color: 'red') }`. (Alternatively you can just redefine " \ - "self.default_scope.)" + "self.default_scope.)", + caller ) end diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index fb5f5b5be0..a91ac302cb 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -156,7 +156,8 @@ module ActiveRecord "`scope :red, -> { where(color: 'red') }`. There are numerous gotchas " \ "in the former usage and it makes the implementation more complicated " \ "and buggy. (If you prefer, you can just define a class method named " \ - "`self.red`.)" + "`self.red`.)", + caller ) end |