diff options
-rw-r--r-- | railties/lib/generator/base.rb | 3 | ||||
-rw-r--r-- | railties/lib/generator/generators/app.rb | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/railties/lib/generator/base.rb b/railties/lib/generator/base.rb index 5f51f93520..604e705e73 100644 --- a/railties/lib/generator/base.rb +++ b/railties/lib/generator/base.rb @@ -7,6 +7,9 @@ require 'thor' module Rails module Generators + class Error < Thor::Error + end + class Base < Thor::Group include Rails::Generators::Actions include Thor::Actions diff --git a/railties/lib/generator/generators/app.rb b/railties/lib/generator/generators/app.rb index c775d0da12..8b22437db6 100644 --- a/railties/lib/generator/generators/app.rb +++ b/railties/lib/generator/generators/app.rb @@ -45,6 +45,13 @@ module Rails::Generators class_option :help, :type => :boolean, :aliases => "-h", :group => :rails, :desc => "Show this help message and quit" + def initialize(*args) + super + if !options[:no_activerecord] && !DATABASES.include?(options[:database]) + raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}." + end + end + def create_root self.root = File.expand_path(app_path, root) empty_directory '.' |