Skip to content

Instantly share code, notes, and snippets.

@djburdick
djburdick / rails_db_migrate_multiple_databases.rb
Created May 22, 2013 17:16
make schema_migrations work over multiple databases. #rails
module ActiveRecord
class Migrator
class << self
def get_all_versions
table = Arel::Table.new(schema_migrations_table_name)
# must not be Base.establish_connection b/c that'll drop the mysql2
# adapter connection and blow up rake db:schema:dump
SchemaMigration.establish_connection(ActiveRecord::Base.configurations['cluster'][Rails.env])
cluster_migrations = SchemaMigration.connection.select_values(table.project(table['version'])).map{ |v| v.to_i }
@trcarden
trcarden / gist:3295935
Created August 8, 2012 15:28
Rails 3.2.7 SSL Localhost (no red warnings, no apache config)
# SSL self signed localhost for rails start to finish, no red warnings.
# 1) Create your private key (any password will do, we remove it below)
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@johnantoni
johnantoni / unicorn.rb
Created August 2, 2012 15:48
unicorn + nginx setup + ssl
unicorn.rb
-----------------------------------
application = "jarvis"
remote_user = "vagrant"
env = ENV["RAILS_ENV"] || "development"
RAILS_ROOT = File.join("/home", remote_user, application)
worker_processes 8
timeout 30