This project is archived and is in readonly mode.
Databases.rake does not find 'encoding' var correctly
-
science
- Tag changed from 2.1, config, database.yml, databases.rake, encoding to 2.1, bug, config, database.yml, databases.rake, encoding
In case anyone else is running into this, here's a monkey patch which can be included in environment.rb that seems to resolve the problem for now (I basically just symbolize the option keys before the actual method sees them):
{{{ class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter old_create_database = self.instance_method(:create_database) define_method(:create_database) do |name, *args|
args[0] = (args[0] || {}).symbolize_keys old_create_database.bind(self).call(name, *args)end end }}}
-
science
Oh goodness - lighthouse uses different tags from trac - sorry about that. Here's that code block for environment.rb again:
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter old_create_database = self.instance_method(:create_database) define_method(:create_database) do |name, *args| args[0] = (args[0] || {}).symbolize_keys old_create_database.bind(self).call(name, *args) end end -
science
This is a mess. Sorry - to late at night. The code above is for the related ticket: http://rails.lighthouseapp.com/p...
The correct patch in environment.rb (below the regular Initializer section) to work around this problem is:
Rails::Initializer.run do |config| # this works around a bug in databases.rake: http://rails.lighthouseapp.com/projects/8994/tickets/940-databasesrake-does-not-find-encoding-var-correctly#ticket-940-1 # databases.rake will use an env var in place of encoding value ENV['CHARSET'] = config.database_configuration[RAILS_ENV]["encoding"] end -
Pratik
- Assigned user set to Tarmo Tänav
- State changed from new to incomplete
Could you please submit a patch - http://rails.lighthouseapp.com/p... ?
Thanks!
-
Prem Sichanugrist (sikachu)
- State changed from incomplete to stale