aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/generators
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/generators')
-rw-r--r--railties/lib/generators/base.rb18
1 files changed, 10 insertions, 8 deletions
diff --git a/railties/lib/generators/base.rb b/railties/lib/generators/base.rb
index 1be0dd6ec2..0ef6d061ff 100644
--- a/railties/lib/generators/base.rb
+++ b/railties/lib/generators/base.rb
@@ -210,11 +210,12 @@ module Rails
#
def self.default_value_for_option(option)
options = Rails::Generators.options
+ generator, base = generator_name.to_sym, base_name.to_sym
- if options[generator_name.to_sym].key?(option)
- options[generator_name.to_sym][option]
- elsif options[base_name.to_sym].key?(option)
- options[base_name.to_sym][option]
+ if options[generator] && options[generator].key?(option)
+ options[generator][option]
+ elsif options[base] && options[base].key?(option)
+ options[base][option]
else
options[:rails][option]
end
@@ -225,11 +226,12 @@ module Rails
#
def self.default_aliases_for_option(option)
aliases = Rails::Generators.aliases
+ generator, base = generator_name.to_sym, base_name.to_sym
- if aliases[generator_name.to_sym].key?(option)
- aliases[generator_name.to_sym][option]
- elsif aliases[base_name.to_sym].key?(option)
- aliases[base_name.to_sym][option]
+ if aliases[generator] && aliases[generator].key?(option)
+ aliases[generator][option]
+ elsif aliases[base] && aliases[base].key?(option)
+ aliases[base][option]
else
aliases[:rails][option]
end