mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Rework NewCallbacks to not require method_missing
This commit is contained in:
parent
e6e3e3dfbc
commit
fb626ee390
1 changed files with 9 additions and 1 deletions
|
@ -353,7 +353,15 @@ module ActiveSupport
|
|||
str = <<-RUBY_EVAL
|
||||
def _run_#{symbol}_callbacks(key = nil)
|
||||
if key
|
||||
send("_run__\#{self.class.name.split("::").last}__#{symbol}__\#{key}__callbacks") { yield if block_given? }
|
||||
name = "_run__\#{self.class.name.split("::").last}__#{symbol}__\#{key}__callbacks"
|
||||
|
||||
if respond_to?(name)
|
||||
send(name) { yield if block_given? }
|
||||
else
|
||||
self.class._create_and_run_keyed_callback(
|
||||
self.class.name.split("::").last,
|
||||
:#{symbol}, key, self) { yield if block_given? }
|
||||
end
|
||||
else
|
||||
#{str}
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue