aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/record_identifier.rb4
-rw-r--r--actionpack/lib/action_dispatch/http/mime_type.rb4
-rw-r--r--actionpack/lib/action_dispatch/testing/integration.rb3
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/date_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb3
-rw-r--r--actionpack/lib/action_view/helpers/form_options_helper.rb2
-rw-r--r--actionpack/lib/action_view/helpers/form_tag_helper.rb10
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb4
-rw-r--r--actionpack/lib/action_view/helpers/url_helper.rb4
-rw-r--r--actionpack/lib/action_view/template.rb2
-rw-r--r--actionpack/lib/action_view/template/resolver.rb2
-rw-r--r--activemodel/lib/active_model/attribute_methods.rb2
-rw-r--r--activemodel/lib/active_model/observing.rb2
-rw-r--r--activerecord/lib/active_record/associations/association.rb2
-rw-r--r--activerecord/lib/active_record/attribute_methods/serialization.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract_adapter.rb8
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb2
-rw-r--r--activerecord/lib/active_record/migration.rb2
-rw-r--r--activerecord/lib/active_record/readonly_attributes.rb2
-rw-r--r--activerecord/lib/active_record/scoping/default.rb3
-rw-r--r--activerecord/lib/active_record/scoping/named.rb3
-rw-r--r--activesupport/CHANGELOG.md5
-rw-r--r--activesupport/lib/active_support/benchmarkable.rb2
-rw-r--r--activesupport/lib/active_support/callbacks.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/array/uniq_by.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/calculations.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/module/introspection.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/proc.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/string/encoding.rb2
-rw-r--r--activesupport/lib/active_support/deprecation/method_wrappers.rb2
-rw-r--r--activesupport/lib/active_support/deprecation/reporting.rb7
-rw-r--r--activesupport/lib/active_support/json/variable.rb2
-rw-r--r--activesupport/lib/active_support/test_case.rb2
-rw-r--r--activesupport/test/deprecation_test.rb2
-rw-r--r--railties/lib/rails/application/configuration.rb5
37 files changed, 59 insertions, 56 deletions
diff --git a/actionpack/lib/action_controller/record_identifier.rb b/actionpack/lib/action_controller/record_identifier.rb
index 90b69879e5..b49128c184 100644
--- a/actionpack/lib/action_controller/record_identifier.rb
+++ b/actionpack/lib/action_controller/record_identifier.rb
@@ -8,12 +8,12 @@ module ActionController
'ActionView::RecodIdentifier module.'
def dom_id(record, prefix = nil)
- ActiveSupport::Deprecation.warn('dom_id ' + MESSAGE, caller)
+ ActiveSupport::Deprecation.warn('dom_id ' + MESSAGE)
ActionView::RecordIdentifier.dom_id(record, prefix)
end
def dom_class(record, prefix = nil)
- ActiveSupport::Deprecation.warn('dom_class ' + MESSAGE, caller)
+ ActiveSupport::Deprecation.warn('dom_class ' + MESSAGE)
ActionView::RecordIdentifier.dom_class(record, prefix)
end
end
diff --git a/actionpack/lib/action_dispatch/http/mime_type.rb b/actionpack/lib/action_dispatch/http/mime_type.rb
index f29730270c..3d560518e1 100644
--- a/actionpack/lib/action_dispatch/http/mime_type.rb
+++ b/actionpack/lib/action_dispatch/http/mime_type.rb
@@ -275,12 +275,12 @@ module Mime
# Returns true if Action Pack should check requests using this Mime Type for possible request forgery. See
# ActionController::RequestForgeryProtection.
def verify_request?
- ActiveSupport::Deprecation.warn("Mime::Type#verify_request? is deprecated and will be removed in Rails 4.1", caller)
+ ActiveSupport::Deprecation.warn "Mime::Type#verify_request? is deprecated and will be removed in Rails 4.1"
@@browser_generated_types.include?(to_sym)
end
def self.browser_generated_types
- ActiveSupport::Deprecation.warn("Mime::Type.browser_generated_types is deprecated and will be removed in Rails 4.1", caller)
+ ActiveSupport::Deprecation.warn "Mime::Type.browser_generated_types is deprecated and will be removed in Rails 4.1"
@@browser_generated_types
end
diff --git a/actionpack/lib/action_dispatch/testing/integration.rb b/actionpack/lib/action_dispatch/testing/integration.rb
index ca96ec5f12..56c7948d24 100644
--- a/actionpack/lib/action_dispatch/testing/integration.rb
+++ b/actionpack/lib/action_dispatch/testing/integration.rb
@@ -498,8 +498,7 @@ module ActionDispatch
def self.app
if !@@app && !ActionDispatch.test_app
- ActiveSupport::Deprecation.warn "Rails application fallback is deprecated " \
- "and no longer works, please set ActionDispatch.test_app", caller
+ ActiveSupport::Deprecation.warn "Rails application fallback is deprecated and no longer works, please set ActionDispatch.test_app"
end
@@app || ActionDispatch.test_app
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 9a2b5ae16a..4eac6514df 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -125,7 +125,7 @@ module ActionView
"the :type option key. This behavior is deprecated and will be remove in Rails 4.1. You should pass " +
":type option explicitly if you want to use other types, for example: " +
"auto_discovery_link_tag(:xml, '/feed.xml', :type => 'application/xml')"
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
end
tag(
diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb
index f43d20c6ed..61e39afd8e 100644
--- a/actionpack/lib/action_view/helpers/date_helper.rb
+++ b/actionpack/lib/action_view/helpers/date_helper.rb
@@ -69,7 +69,7 @@ module ActionView
options = include_seconds_or_options
else
ActiveSupport::Deprecation.warn "distance_of_time_in_words and time_ago_in_words now accept :include_seconds " +
- "as a part of options hash, not a boolean argument", caller
+ "as a part of options hash, not a boolean argument"
options[:include_seconds] ||= !!include_seconds_or_options
end
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index 1a0ce29756..6abf1e1751 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -1181,8 +1181,7 @@ module ActionView
def initialize(object_name, object, template, options, block=nil)
if block
- message = "Giving a block to FormBuilder is deprecated and has no effect anymore."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn "Giving a block to FormBuilder is deprecated and has no effect anymore."
end
@nested_child_index = {}
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb
index dec87013d3..87f4380baf 100644
--- a/actionpack/lib/action_view/helpers/form_options_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_options_helper.rb
@@ -521,7 +521,7 @@ module ActionView
options = {}
message = "Passing the prompt to grouped_options_for_select as an argument is deprecated. " \
"Please use an options hash like `{ prompt: #{prompt.inspect} }`."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
end
body = "".html_safe
diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb
index 11bc0cbec8..7680208702 100644
--- a/actionpack/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb
@@ -427,7 +427,7 @@ module ActionView
if disable_with = options.delete("disable_with")
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { disable_with: \'Text\' }' instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
options["data-disable-with"] = disable_with
end
@@ -435,7 +435,7 @@ module ActionView
if confirm = options.delete("confirm")
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead'."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
options["data-confirm"] = confirm
end
@@ -489,7 +489,7 @@ module ActionView
if disable_with = options.delete("disable_with")
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { disable_with: \'Text\' }' instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
options["data-disable-with"] = disable_with
end
@@ -497,7 +497,7 @@ module ActionView
if confirm = options.delete("confirm")
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead'."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
options["data-confirm"] = confirm
end
@@ -543,7 +543,7 @@ module ActionView
if confirm = options.delete("confirm")
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead'."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
options["data-confirm"] = confirm
end
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 6be35168dd..7bf659d5f2 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -80,7 +80,7 @@ module ActionView
def button_to_function(name, function=nil, html_options={})
message = "button_to_function is deprecated and will be removed from Rails 4.1. We recomend to use Unobtrusive JavaScript instead. " +
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function};"
@@ -102,7 +102,7 @@ module ActionView
def link_to_function(name, function, html_options={})
message = "link_to_function is deprecated and will be removed from Rails 4.1. We recomend to use Unobtrusive JavaScript instead. " +
"See http://guides.rubyonrails.org/working_with_javascript_in_rails.html#unobtrusive-javascript"
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;"
href = html_options[:href] || '#'
diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb
index 2a1dd86e0a..48ac4312b6 100644
--- a/actionpack/lib/action_view/helpers/url_helper.rb
+++ b/actionpack/lib/action_view/helpers/url_helper.rb
@@ -579,7 +579,7 @@ module ActionView
if confirm
message = ":confirm option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { confirm: \'Text\' }' instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
html_options["data-confirm"] = confirm
end
@@ -589,7 +589,7 @@ module ActionView
if disable_with
message = ":disable_with option is deprecated and will be removed from Rails 4.1. " \
"Use 'data: { disable_with: \'Text\' }' instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
html_options["data-disable-with"] = disable_with
end
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index 01a6bb42c8..aefc42be48 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -150,7 +150,7 @@ module ActionView
def mime_type
message = 'Template#mime_type is deprecated and will be removed in Rails 4.1. Please use type method instead.'
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
@mime_type ||= Mime::Type.lookup_by_extension(@formats.first.to_s) if @formats.first
end
diff --git a/actionpack/lib/action_view/template/resolver.rb b/actionpack/lib/action_view/template/resolver.rb
index 086cc0bacc..fc77c1485d 100644
--- a/actionpack/lib/action_view/template/resolver.rb
+++ b/actionpack/lib/action_view/template/resolver.rb
@@ -237,7 +237,7 @@ module ActionView
unless extension
message = "The file #{path} did not specify a template handler. The default is currently ERB, " \
"but will change to RAW in the future."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
end
handler = Template.handler_for_extension(extension)
diff --git a/activemodel/lib/active_model/attribute_methods.rb b/activemodel/lib/active_model/attribute_methods.rb
index 0f5c7f13a8..86eaad830e 100644
--- a/activemodel/lib/active_model/attribute_methods.rb
+++ b/activemodel/lib/active_model/attribute_methods.rb
@@ -387,7 +387,7 @@ module ActiveModel
"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)
+ ActiveSupport::Deprecation.warn message
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 277bf30b6a..5f1c99ce62 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, caller)
+ ActiveSupport::Deprecation.warn msg
observers_count
end
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index 7c09e23f27..b989a1e161 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -85,7 +85,7 @@ module ActiveRecord
end
def scoped
- ActiveSupport::Deprecation.warn("#scoped is deprecated. use #scope instead.", caller)
+ ActiveSupport::Deprecation.warn "#scoped is deprecated. use #scope instead."
scope
end
diff --git a/activerecord/lib/active_record/attribute_methods/serialization.rb b/activerecord/lib/active_record/attribute_methods/serialization.rb
index d8fe4afd54..ada79c3567 100644
--- a/activerecord/lib/active_record/attribute_methods/serialization.rb
+++ b/activerecord/lib/active_record/attribute_methods/serialization.rb
@@ -46,7 +46,7 @@ module ActiveRecord
def serialized_attributes
message = "Instance level serialized_attributes method is deprecated, please use class level method."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
defined?(@serialized_attributes) ? @serialized_attributes : self.class.serialized_attributes
end
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
index 0b03d413dc..8517ce5fc5 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
@@ -3,7 +3,7 @@ require 'bigdecimal'
require 'bigdecimal/util'
require 'active_support/core_ext/benchmark'
require 'active_record/connection_adapters/schema_cache'
-require 'active_record/connection_adapters/abstract/schema_dumper'
+require 'active_record/connection_adapters/abstract/schema_dumper'
require 'monitor'
require 'active_support/deprecation'
@@ -255,16 +255,16 @@ module ActiveRecord
end
def increment_open_transactions
- ActiveSupport::Deprecation.warn("#increment_open_transactions is deprecated and has no effect", caller)
+ ActiveSupport::Deprecation.warn "#increment_open_transactions is deprecated and has no effect"
end
def decrement_open_transactions
- ActiveSupport::Deprecation.warn("#decrement_open_transactions is deprecated and has no effect", caller)
+ ActiveSupport::Deprecation.warn "#decrement_open_transactions is deprecated and has no effect"
end
def transaction_joinable=(joinable)
message = "#transaction_joinable= is deprecated. Please pass the :joinable option to #begin_transaction instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
@transaction.joinable = joinable
end
diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb
index 76f8e899ed..80984f39c9 100644
--- a/activerecord/lib/active_record/connection_adapters/column.rb
+++ b/activerecord/lib/active_record/connection_adapters/column.rb
@@ -109,7 +109,7 @@ module ActiveRecord
def type_cast_code(var_name)
message = "Column#type_cast_code is deprecated in favor of using Column#type_cast only, " \
"and it is going to be removed in future Rails versions."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
klass = self.class.name
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
index e82e809414..34d7a246b2 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/database_statements.rb
@@ -223,7 +223,7 @@ module ActiveRecord
def outside_transaction?
message = "#outside_transaction? is deprecated. This method was only really used " \
"internally, but you can use #transaction_open? instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
@connection.transaction_status == PGconn::PQTRANS_IDLE
end
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index fcadd4767d..5499f37802 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -733,7 +733,7 @@ module ActiveRecord
if block_given?
message = "block argument to migrate is deprecated, please filter migrations before constructing the migrator"
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
running.select! { |m| yield m }
end
diff --git a/activerecord/lib/active_record/readonly_attributes.rb b/activerecord/lib/active_record/readonly_attributes.rb
index 71921c79b0..8499bb16e7 100644
--- a/activerecord/lib/active_record/readonly_attributes.rb
+++ b/activerecord/lib/active_record/readonly_attributes.rb
@@ -23,7 +23,7 @@ module ActiveRecord
def _attr_readonly
message = "Instance level _attr_readonly method is deprecated, please use class level method."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
defined?(@_attr_readonly) ? @_attr_readonly : self.class._attr_readonly
end
end
diff --git a/activerecord/lib/active_record/scoping/default.rb b/activerecord/lib/active_record/scoping/default.rb
index 705b719a3a..6835d0e01b 100644
--- a/activerecord/lib/active_record/scoping/default.rb
+++ b/activerecord/lib/active_record/scoping/default.rb
@@ -95,8 +95,7 @@ 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.)",
- caller
+ "self.default_scope.)"
)
end
diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb
index a91ac302cb..fb5f5b5be0 100644
--- a/activerecord/lib/active_record/scoping/named.rb
+++ b/activerecord/lib/active_record/scoping/named.rb
@@ -156,8 +156,7 @@ 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`.)",
- caller
+ "`self.red`.)"
)
end
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 83e763fd77..1c1edc9048 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,5 +1,10 @@
## Rails 4.0.0 (unreleased) ##
+* Make callstack attribute optional in
+ ActiveSupport::Deprecation::Reporting methods `warn` and `deprecation_warning`
+
+ *Alexey Gaziev*
+
* Implement HashWithIndifferentAccess#replace so key? works correctly. *David Graham*
* Handle the possible Permission Denied errors atomic.rb might trigger due to its chown and chmod calls. *Daniele Sluijters*
diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb
index 4c7a694c52..6413502b53 100644
--- a/activesupport/lib/active_support/benchmarkable.rb
+++ b/activesupport/lib/active_support/benchmarkable.rb
@@ -49,7 +49,7 @@ module ActiveSupport
# Silence the logger during the execution of the block.
def silence
message = "ActiveSupport::Benchmarkable#silence is deprecated. It will be removed from Rails 4.1."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger
yield
ensure
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index a4ea6748f9..8199f431f1 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -284,13 +284,13 @@ module ActiveSupport
if !filter.respond_to?(kind) && filter.respond_to?(:filter)
message = "Filter object with #filter method is deprecated. Define method corresponding " \
"to filter type (#before, #after or #around)."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
filter.singleton_class.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def #{kind}(context, &block) filter(context, &block) end
RUBY_EVAL
elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around && !filter.respond_to?(:around)
message = "Filter object with #before and #after methods is deprecated. Define #around method instead."
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
def filter.around(context)
should_continue = before(context)
yield if should_continue
diff --git a/activesupport/lib/active_support/core_ext/array/uniq_by.rb b/activesupport/lib/active_support/core_ext/array/uniq_by.rb
index c1d5a355a4..ca3b7748cd 100644
--- a/activesupport/lib/active_support/core_ext/array/uniq_by.rb
+++ b/activesupport/lib/active_support/core_ext/array/uniq_by.rb
@@ -5,7 +5,7 @@ class Array
#
# [1, 2, 3, 4].uniq_by { |i| i.odd? } # => [1, 2]
def uniq_by(&block)
- ActiveSupport::Deprecation.warn 'uniq_by is deprecated. Use Array#uniq instead', caller
+ ActiveSupport::Deprecation.warn 'uniq_by is deprecated. Use Array#uniq instead'
uniq(&block)
end
@@ -13,7 +13,7 @@ class Array
#
# Same as +uniq_by+, but modifies +self+.
def uniq_by!(&block)
- ActiveSupport::Deprecation.warn 'uniq_by! is deprecated. Use Array#uniq! instead', caller
+ ActiveSupport::Deprecation.warn 'uniq_by! is deprecated. Use Array#uniq! instead'
uniq!(&block)
end
end
diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
index 385aa586bb..0c6437b02b 100644
--- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
@@ -4,7 +4,7 @@ class DateTime
class << self
# *DEPRECATED*: Use +DateTime.civil_from_format+ directly.
def local_offset
- ActiveSupport::Deprecation.warn 'DateTime.local_offset is deprecated. Use DateTime.civil_from_format directly.', caller
+ ActiveSupport::Deprecation.warn 'DateTime.local_offset is deprecated. Use DateTime.civil_from_format directly.'
::Time.local(2012).utc_offset.to_r / 86400
end
diff --git a/activesupport/lib/active_support/core_ext/module/introspection.rb b/activesupport/lib/active_support/core_ext/module/introspection.rb
index 649a969149..08e5f8a5c3 100644
--- a/activesupport/lib/active_support/core_ext/module/introspection.rb
+++ b/activesupport/lib/active_support/core_ext/module/introspection.rb
@@ -72,7 +72,7 @@ class Module
# This method is useful for forward compatibility, since Ruby 1.8 returns
# constant names as strings, whereas 1.9 returns them as symbols.
def local_constant_names
- ActiveSupport::Deprecation.warn 'Module#local_constant_names is deprecated, use Module#local_constants instead', caller
+ ActiveSupport::Deprecation.warn 'Module#local_constant_names is deprecated, use Module#local_constants instead'
local_constants.map { |c| c.to_s }
end
end
diff --git a/activesupport/lib/active_support/core_ext/proc.rb b/activesupport/lib/active_support/core_ext/proc.rb
index cd63740940..166c3855a0 100644
--- a/activesupport/lib/active_support/core_ext/proc.rb
+++ b/activesupport/lib/active_support/core_ext/proc.rb
@@ -3,7 +3,7 @@ require "active_support/deprecation"
class Proc #:nodoc:
def bind(object)
- ActiveSupport::Deprecation.warn 'Proc#bind is deprecated and will be removed in future versions', caller
+ ActiveSupport::Deprecation.warn 'Proc#bind is deprecated and will be removed in future versions'
block, time = self, Time.now
object.class_eval do
diff --git a/activesupport/lib/active_support/core_ext/string/encoding.rb b/activesupport/lib/active_support/core_ext/string/encoding.rb
index dc635ed6a5..a583b914db 100644
--- a/activesupport/lib/active_support/core_ext/string/encoding.rb
+++ b/activesupport/lib/active_support/core_ext/string/encoding.rb
@@ -2,7 +2,7 @@ require 'active_support/deprecation'
class String
def encoding_aware?
- ActiveSupport::Deprecation.warn 'String#encoding_aware? is deprecated', caller
+ ActiveSupport::Deprecation.warn 'String#encoding_aware? is deprecated'
true
end
end
diff --git a/activesupport/lib/active_support/deprecation/method_wrappers.rb b/activesupport/lib/active_support/deprecation/method_wrappers.rb
index d3907b03e5..cab8a1b14d 100644
--- a/activesupport/lib/active_support/deprecation/method_wrappers.rb
+++ b/activesupport/lib/active_support/deprecation/method_wrappers.rb
@@ -33,7 +33,7 @@ module ActiveSupport
method_names.each do |method_name|
target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation|
target_module.send(:define_method, "#{target}_with_deprecation#{punctuation}") do |*args, &block|
- deprecator.deprecation_warning(method_name, options[method_name], caller)
+ deprecator.deprecation_warning(method_name, options[method_name])
send(:"#{target}_without_deprecation#{punctuation}", *args, &block)
end
end
diff --git a/activesupport/lib/active_support/deprecation/reporting.rb b/activesupport/lib/active_support/deprecation/reporting.rb
index 1ce54d9381..a7d265d732 100644
--- a/activesupport/lib/active_support/deprecation/reporting.rb
+++ b/activesupport/lib/active_support/deprecation/reporting.rb
@@ -11,8 +11,10 @@ module ActiveSupport
#
# ActiveSupport::Deprecation.warn('something broke!')
# # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
- def warn(message = nil, callstack = caller)
+ def warn(message = nil, callstack = nil)
return if silenced
+
+ callstack ||= caller(2)
deprecation_message(callstack, message).tap do |m|
behavior.each { |b| b.call(m, callstack) }
end
@@ -34,7 +36,8 @@ module ActiveSupport
@silenced = old_silenced
end
- def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = caller)
+ def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
+ caller_backtrace ||= caller(2)
deprecated_method_warning(deprecated_method_name, message).tap do |msg|
warn(msg, caller_backtrace)
end
diff --git a/activesupport/lib/active_support/json/variable.rb b/activesupport/lib/active_support/json/variable.rb
index 42e25fbdb3..d69dab6408 100644
--- a/activesupport/lib/active_support/json/variable.rb
+++ b/activesupport/lib/active_support/json/variable.rb
@@ -7,7 +7,7 @@ module ActiveSupport
def initialize(*args)
message = 'ActiveSupport::JSON::Variable is deprecated and will be removed in Rails 4.1. ' \
'For your own custom JSON literals, define #as_json and #encode_json yourself.'
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
super
end
diff --git a/activesupport/lib/active_support/test_case.rb b/activesupport/lib/active_support/test_case.rb
index 646e70c29f..8b06739b7f 100644
--- a/activesupport/lib/active_support/test_case.rb
+++ b/activesupport/lib/active_support/test_case.rb
@@ -44,7 +44,7 @@ module ActiveSupport
super
else
message = "`describe` without a block is deprecated, please switch to: `def self.name; #{text.inspect}; end`\n"
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
def self.name
diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb
index c081103cc7..332100f5a1 100644
--- a/activesupport/test/deprecation_test.rb
+++ b/activesupport/test/deprecation_test.rb
@@ -9,7 +9,7 @@ class Deprecatee
def old_request; @request end
def partially(foo = nil)
- ActiveSupport::Deprecation.warn('calling with foo=nil is out', caller) if foo.nil?
+ ActiveSupport::Deprecation.warn('calling with foo=nil is out') if foo.nil?
end
def not() 2 end
diff --git a/railties/lib/rails/application/configuration.rb b/railties/lib/rails/application/configuration.rb
index ab10523861..cc21213f1c 100644
--- a/railties/lib/rails/application/configuration.rb
+++ b/railties/lib/rails/application/configuration.rb
@@ -91,7 +91,7 @@ module Rails
message = "config.threadsafe! is deprecated. Rails applications " \
"behave by default as thread safe in production as long as config.cache_classes and " \
"config.eager_load are set to true"
- ActiveSupport::Deprecation.warn(message, caller)
+ ActiveSupport::Deprecation.warn message
@cache_classes = true
@eager_load = true
self
@@ -142,8 +142,7 @@ module Rails
end
def whiny_nils=(*)
- ActiveSupport::Deprecation.warn "config.whiny_nils option " \
- "is deprecated and no longer works", caller
+ ActiveSupport::Deprecation.warn "config.whiny_nils option is deprecated and no longer works"
end
end
end