From 34530f5bd566be360be4030a38b898cba97bee85 Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Wed, 2 Nov 2016 10:17:22 +0900 Subject: remove warning from railtie This removes the following warnings. ```ruby rails/railties/lib/rails/railtie.rb:186: warning: instance variable @rake_tasks not initialized rails/railties/lib/rails/railtie.rb:186: warning: instance variable @rake_tasks not initialized rails/railties/lib/rails/railtie.rb:186: warning: instance variable @load_console not initialized rails/railties/lib/rails/railtie.rb:186: warning: instance variable @rake_tasks not initialized ``` --- railties/lib/rails/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'railties/lib') 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 -- cgit v1.2.3