Skip to content
Michael Grosser edited this page Dec 3, 2015 · 3 revisions

Patch spring to reconnect the database and then force-enabled it by running with DISABLE_SPRING=0

# config/spring.rb
require "active_support/core_ext/module/aliasing"
require "spring/application"

class Spring::Application
  def connect_database_with_reconfigure_database
    disconnect_database
    reconfigure_database
    connect_database_without_reconfigure_database
  end

  alias_method_chain :connect_database, :reconfigure_database

  def reconfigure_database
    if active_record_configured?
      ActiveRecord::Base.configurations =
        Rails.application.config.database_configuration
    end
  end
end

( ͡° ͜ʖ ͡°) ¯_(ツ)_/¯

Clone this wiki locally