diff options
author | Kieran Pilkington <kieran@katipo.co.nz> | 2010-03-12 21:24:56 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-03-12 21:33:39 +0100 |
commit | 9268b598bb20523e1b886f8811598647ce427ef9 (patch) | |
tree | 14e1a6b8301bd8a68813f03c6415e0736b95a186 /railties/lib/generators/rails | |
parent | e484d4ae5684b9ca49b27a844bf48c91c945814e (diff) | |
download | rails-9268b598bb20523e1b886f8811598647ce427ef9.tar.gz rails-9268b598bb20523e1b886f8811598647ce427ef9.tar.bz2 rails-9268b598bb20523e1b886f8811598647ce427ef9.zip |
Add a check to ensure that the application name does not already exist, i.e. String or Module are part of ruby [#3872 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties/lib/generators/rails')
-rw-r--r-- | railties/lib/generators/rails/app/app_generator.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb index 92e0d37436..888e3b2ddd 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -220,6 +220,8 @@ module Rails::Generators raise Error, "Invalid application name #{app_name}. Please give a name which does not start with numbers." elsif RESERVED_NAMES.include?(app_name) raise Error, "Invalid application name #{app_name}. Please give a name which does not match one of the reserved rails words." + elsif Object.const_defined?(app_const_base) + raise Error, "Invalid application name #{app_name}, constant #{app_const_base} is already in use. Please choose another application name." end end |