diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-05-31 15:51:01 -0700 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-05-31 15:51:01 -0700 |
commit | 9b75483bf361f44046d1cb86bd2acae6c4f856f3 (patch) | |
tree | 282350bb3de29586a232f77b3b8a6db5cc0800e4 /railties | |
parent | f7015336f66d284cff8ecb89df9f430791ac57ea (diff) | |
download | rails-9b75483bf361f44046d1cb86bd2acae6c4f856f3.tar.gz rails-9b75483bf361f44046d1cb86bd2acae6c4f856f3.tar.bz2 rails-9b75483bf361f44046d1cb86bd2acae6c4f856f3.zip |
Added better error message for when the class name is already used (and dont show suggestions if there are none)
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails_generator/commands.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/railties/lib/rails_generator/commands.rb b/railties/lib/rails_generator/commands.rb index 03b7d354a6..08ecbfb5cf 100644 --- a/railties/lib/rails_generator/commands.rb +++ b/railties/lib/rails_generator/commands.rb @@ -380,12 +380,14 @@ HELP # Thanks to Florian Gross (flgr). def raise_class_collision(class_name) message = <<end_message - The name '#{class_name}' is reserved by Ruby on Rails. + The name '#{class_name}' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again. end_message if suggest = find_synonyms(class_name) - message << "\n Suggestions: \n\n" - message << suggest.join("\n") + if suggest.any? + message << "\n Suggestions: \n\n" + message << suggest.join("\n") + end end raise UsageError, message end |