aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/railtie.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb
index ae26501741..696db61f01 100644
--- a/railties/lib/rails/railtie.rb
+++ b/railties/lib/rails/railtie.rb
@@ -194,7 +194,7 @@ module Rails
# `#each_registered_block(type, &block)`
def register_block_for(type, &blk)
var_name = "@#{type}"
- blocks = instance_variable_get(var_name) || instance_variable_set(var_name, [])
+ blocks = instance_variable_defined?(var_name) ? instance_variable_get(var_name) : instance_variable_set(var_name, [])
blocks << blk if blk
blocks
end