Skip to content

Commit

Permalink
Work on a dup'ed options hash
Browse files Browse the repository at this point in the history
Otherwise, at least using JRuby, the replacements in
convert_database_option_for_jruby won't work. Thus a call to

    bundle exec rails app:update

fails. Simply replacing those replace statements doesn't seem to work
either, since the options hash seems to be frozen, too.
  • Loading branch information
ckoenig committed Jan 9, 2018
1 parent 5a50146 commit c33f47d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions railties/lib/rails/generators/app_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,13 @@ def gem_for_database

def convert_database_option_for_jruby
if defined?(JRUBY_VERSION)
case options[:database]
when "postgresql" then options[:database].replace "jdbcpostgresql"
when "mysql" then options[:database].replace "jdbcmysql"
when "sqlite3" then options[:database].replace "jdbcsqlite3"
opt = options.dup
case opt[:database]
when "postgresql" then opt[:database] = "jdbcpostgresql"
when "mysql" then opt[:database] = "jdbcmysql"
when "sqlite3" then opt[:database] = "jdbcsqlite3"
end
self.options = opt.freeze
end
end

Expand Down

0 comments on commit c33f47d

Please sign in to comment.