Method: Rails::Generators::Db::System::ChangeGenerator#initialize

Defined in:
railties/lib/rails/generators/rails/db/system/change/change_generator.rb

#initializeChangeGenerator

Returns a new instance of ChangeGenerator.



25
26
27
28
29
30
31
32
33
34
35
# File 'railties/lib/rails/generators/rails/db/system/change/change_generator.rb', line 25

def initialize(*)
  super

  unless Database::DATABASES.include?(options[:to])
    raise Error, "Invalid value for --to option. Supported preconfigurations are: #{Database::DATABASES.join(", ")}."
  end

  opt = options.dup
  opt[:database] ||= opt[:to]
  self.options = opt.freeze
end