diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-10-30 03:47:07 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-10-30 03:47:07 -0700 |
commit | 0ad6c08ca50d19a9994bf4e9a464e1a44cb612a0 (patch) | |
tree | faceebca94859de69e12f4d7b48e9958b1631575 /activerecord | |
parent | 4e23c0ef341c2cba6a4b21022d4ffbabdaa6e3da (diff) | |
parent | b955939d55b71905fa3e5036149ee4c84943c599 (diff) | |
download | rails-0ad6c08ca50d19a9994bf4e9a464e1a44cb612a0.tar.gz rails-0ad6c08ca50d19a9994bf4e9a464e1a44cb612a0.tar.bz2 rails-0ad6c08ca50d19a9994bf4e9a464e1a44cb612a0.zip |
Merge pull request #6107 from gazay/make_caller_attribute_in_deprecation_optional
Make callstack attribute optional in AS:Deprecation
Diffstat (limited to 'activerecord')
9 files changed, 12 insertions, 14 deletions
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 |