aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Sieger <nick@nicksieger.com>2011-06-15 12:59:11 -0500
committerNick Sieger <nick@nicksieger.com>2011-06-21 13:34:07 -0700
commit4dd2d07d4a823036b90bf8db75749eb33aafd337 (patch)
tree94ad1799b4619379914fa5afbbe2d47b6f717a89
parentf12f756473671f38887754fe136fda51efa4a440 (diff)
downloadrails-4dd2d07d4a823036b90bf8db75749eb33aafd337.tar.gz
rails-4dd2d07d4a823036b90bf8db75749eb33aafd337.tar.bz2
rails-4dd2d07d4a823036b90bf8db75749eb33aafd337.zip
Convert database names to ones appropriate for JRuby
-rw-r--r--railties/lib/rails/generators/app_base.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 3346c5ec13..378eceb4c3 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -64,8 +64,8 @@ module Rails
def initialize(*args)
@original_wd = Dir.pwd
-
super
+ convert_database_option_for_jruby
end
protected
@@ -165,6 +165,17 @@ module Rails
end
end
+ def convert_database_option_for_jruby
+ if defined?(JRUBY_VERSION)
+ case options[:database]
+ when "oracle" then options[:database].replace "jdbc"
+ when "postgresql" then options[:database].replace "jdbcpostgresql"
+ when "mysql" then options[:database].replace "jdbcmysql"
+ when "sqlite3" then options[:database].replace "jdbcsqlite3"
+ end
+ end
+ end
+
def ruby_debugger_gemfile_entry
if RUBY_VERSION < "1.9"
"gem 'ruby-debug'"