aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-10-29 08:42:16 -0700
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2012-10-29 08:42:16 -0700
commitd1c95d912ec39e7e374aee605a1d6fb11f8521d7 (patch)
tree9ec15855e1cab91c346d5a09e6adb593c7585608 /activemodel
parent72e6fb005fbdd211883282fc761d3ded23ef7fbb (diff)
parent0b7067d8497c4d832b32233888ce973ab4357e5d (diff)
downloadrails-d1c95d912ec39e7e374aee605a1d6fb11f8521d7.tar.gz
rails-d1c95d912ec39e7e374aee605a1d6fb11f8521d7.tar.bz2
rails-d1c95d912ec39e7e374aee605a1d6fb11f8521d7.zip
Merge pull request #8063 from nikitug/deprecation_caller_context
Provide a call stack for deprecation warnings where needed.
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb11
-rw-r--r--activemodel/lib/active_model/observing.rb2
2 files changed, 6 insertions, 7 deletions
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index a1d01b2c89..0f5c7f13a8 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -383,12 +383,11 @@ module ActiveModel
def initialize(options = {})
if options[:prefix] == '' || options[:suffix] == ''
- ActiveSupport::Deprecation.warn(
- "Specifying an empty prefix/suffix for an attribute method is no longer " \
- "necessary. If the un-prefixed/suffixed version of the method has not been " \
- "defined when `define_attribute_methods` is called, it will be defined " \
- "automatically."
- )
+ message = "Specifying an empty prefix/suffix for an attribute method is no longer " \
+ "necessary. If the un-prefixed/suffixed version of the method has not been " \
+ "defined when `define_attribute_methods` is called, it will be defined " \
+ "automatically."
+ ActiveSupport::Deprecation.warn(message, caller)
end
@prefix, @suffix = options.fetch(:prefix, ''), options.fetch(:suffix, '')
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb
index 9419645e7b..277bf30b6a 100644
--- a/activemodel/lib/active_model/observing.rb
+++ b/activemodel/lib/active_model/observing.rb
@@ -172,7 +172,7 @@ module ActiveModel
# <tt>count_observers</tt> is deprecated. Use #observers_count.
def count_observers
msg = "count_observers is deprecated in favor of observers_count"
- ActiveSupport::Deprecation.warn(msg)
+ ActiveSupport::Deprecation.warn(msg, caller)
observers_count
end