Skip to content

Instantly share code, notes, and snippets.

@anoiaque
Created March 15, 2012 17:30
Show Gist options
  • Save anoiaque/2045480 to your computer and use it in GitHub Desktop.
Save anoiaque/2045480 to your computer and use it in GitHub Desktop.

Revisions

  1. anoiaque created this gist Mar 15, 2012.
    10 changes: 10 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #In an initializer

    def ENV.[]= key, value
    if key == 'RAILS_DATABASE_CONNECTION'
    ActiveRecord::Base.establish_connection (JSON.parse(value))
    end
    store(key, value)
    end

    ENV["RAILS_DATABASE_CONNECTION"] = %Q{{"database":"foo","adapter":"sqlite3"}} #...