Skip to content

Instantly share code, notes, and snippets.

View jgelo's full-sized avatar

Jon Gelo jgelo

View GitHub Profile
In Rails 3.1, count is ignoring the include specified in my default_scope in BudgetAccount -
class Budget
has_many :accounts, :class_name => 'BudgetAccount', :as => :poly, :dependent => :destroy
end
class BudgetAccount
belongs_to :account
belongs_to :poly, :polymorphic => true
default_scope where('accounts.inactive = ?', false).order('accounts.number').includes(:account)
@jgelo
jgelo / app.sh
Created October 6, 2010 02:32
RVM w/ multiple rubies + multiple Unicorns
#!/bin/bash
#
# Unicorn application launcher
# Load the env config and RVM
. /etc/unicorn/$1.conf
. /usr/local/rvm/scripts/rvm
# Switch to the proper ruby
rvm use $RUBY