diff options
author | rick <technoweenie@gmail.com> | 2008-05-31 15:59:01 -0700 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2008-05-31 15:59:01 -0700 |
commit | 2506e5c9a7d251680f0029d1616f3edb1e3a8db3 (patch) | |
tree | 1479c9a2d19cb15e179c260eb6135b8adde1927a /railties | |
parent | 9c4f00350a61987afad50ebb8d319d7e889b6cfd (diff) | |
parent | f32bceeee1adb0979f49db7e8111ba318e23c85c (diff) | |
download | rails-2506e5c9a7d251680f0029d1616f3edb1e3a8db3.tar.gz rails-2506e5c9a7d251680f0029d1616f3edb1e3a8db3.tar.bz2 rails-2506e5c9a7d251680f0029d1616f3edb1e3a8db3.zip |
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'railties')
-rw-r--r-- | railties/environments/environment.rb | 5 | ||||
-rw-r--r-- | railties/lib/commands/dbconsole.rb | 14 | ||||
-rw-r--r-- | railties/lib/rails_generator/commands.rb | 8 |
3 files changed, 17 insertions, 10 deletions
diff --git a/railties/environments/environment.rb b/railties/environments/environment.rb index 468fa45ef6..a85ade371b 100644 --- a/railties/environments/environment.rb +++ b/railties/environments/environment.rb @@ -64,7 +64,4 @@ Rails::Initializer.run do |config| # Activate observers that should always be running # config.active_record.observers = :cacher, :garbage_collector - - # Make ActiveRecord only save the attributes that have changed since the record was loaded. - # config.active_record.partial_updates = true -end
\ No newline at end of file +end diff --git a/railties/lib/commands/dbconsole.rb b/railties/lib/commands/dbconsole.rb index b81997aa59..17acb7b68f 100644 --- a/railties/lib/commands/dbconsole.rb +++ b/railties/lib/commands/dbconsole.rb @@ -2,8 +2,13 @@ require 'erb' require 'yaml' require 'optparse' +include_password = false + OptionParser.new do |opt| - opt.banner = "Usage: dbconsole [environment]" + opt.banner = "Usage: dbconsole [options] [environment]" + opt.on("-p", "--include-password", "Automatically provide the database from database.yml") do |v| + include_password = true + end opt.parse!(ARGV) abort opt.to_s unless (0..1).include?(ARGV.size) end @@ -31,10 +36,13 @@ when "mysql" 'port' => '--port', 'socket' => '--socket', 'username' => '--user', - 'password' => '--password', 'encoding' => '--default-character-set' }.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact + if config['password'] && include_password + args << "--password=#{config['password']}" + end + args << config['database'] exec(find_cmd('mysql5', 'mysql'), *args) @@ -43,7 +51,7 @@ when "postgresql" ENV['PGUSER'] = config["username"] if config["username"] ENV['PGHOST'] = config["host"] if config["host"] ENV['PGPORT'] = config["port"].to_s if config["port"] - ENV['PGPASSWORD'] = config["password"].to_s if config["password"] + ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && include_password exec(find_cmd('psql'), config["database"]) when "sqlite" 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 |