aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-07-05 13:53:10 +0200
committerYves Senn <yves.senn@gmail.com>2013-07-05 13:53:10 +0200
commit19f842b5fac1070849800042f8e429d3645b1828 (patch)
tree83c069d6dba961a2271b9437ae76d44d800c9f69 /activesupport
parent3196ceaba28be64d890e9544af218481ad54cf16 (diff)
downloadrails-19f842b5fac1070849800042f8e429d3645b1828.tar.gz
rails-19f842b5fac1070849800042f8e429d3645b1828.tar.bz2
rails-19f842b5fac1070849800042f8e429d3645b1828.zip
Revert "remove string based terminators for `ActiveSupport::Callbacks`."
This reverts commit d108672dada7ba97d3b3b56f0c6001cea621061e. Conflicts: activesupport/CHANGELOG.md
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md4
-rw-r--r--activesupport/lib/active_support/callbacks.rb6
2 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 87c850bcf0..8c07a034cc 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,7 +1,3 @@
-* Remove deprecated string based terminators for `ActiveSupport::Callbacks`.
-
- *Yves Senn*
-
* Remove deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`).
*Arun Agrawal*
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index d2991a218b..5c738572a8 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -718,6 +718,12 @@ module ActiveSupport
# would call <tt>Audit#save</tt>.
def define_callbacks(*names)
options = names.extract_options!
+ if options.key?(:terminator) && String === options[:terminator]
+ ActiveSupport::Deprecation.warn "String based terminators are deprecated, please use a lambda"
+ value = options[:terminator]
+ line = class_eval "lambda { |result| #{value} }", __FILE__, __LINE__
+ options[:terminator] = lambda { |target, result| target.instance_exec(result, &line) }
+ end
names.each do |name|
class_attribute "_#{name}_callbacks"