diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-15 16:53:54 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-15 16:53:54 +0200 |
commit | baa4781ac7174e527c2471b4c86ea51c0f65cf6b (patch) | |
tree | ac8fac2379845ce30d9e502ff4511be0488a0dd1 /railties/lib/generators | |
parent | 7022b58842ec3490d85efc5b947d86a0fd72d0cb (diff) | |
download | rails-baa4781ac7174e527c2471b4c86ea51c0f65cf6b.tar.gz rails-baa4781ac7174e527c2471b4c86ea51c0f65cf6b.tar.bz2 rails-baa4781ac7174e527c2471b4c86ea51c0f65cf6b.zip |
Allow nil and false to be given as configuration values and avoid creating unecessary hashes.
Diffstat (limited to 'railties/lib/generators')
-rw-r--r-- | railties/lib/generators/base.rb | 18 |
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 |