Skip to content

Instantly share code, notes, and snippets.

Given /^the following (.+) exist(?:s|):$/ do |model_name, table|
model_name = model_name.split(' ')
variation_name = []
begin
model = model_name.join('_').classify.constantize
rescue
variation_name << model_name.shift
if model_name.length > 0 then retry else raise end
end
args = []
@khalsah
khalsah / migrate.rb
Created May 11, 2011 20:04 — forked from zacclark/migrate.rb
VHGDB - Migrating statuses to actions
class MoveStatusDataToStatusChangeActions < ActiveRecord::Migration
def self.up
execute <<-EOQ
INSERT INTO actions(status_code, attendance_id, type, occurred_at, created_at, updated_at, archived_title, archived_company_id)
SELECT
statuses.status, statuses.attendance_id, 'StatusChangeAction', statuses.created_at, statuses.created_at, statuses.updated_at, titles.title, companies.id
FROM statuses
JOIN attendances ON attendances.id = statuses.attendance_id
JOIN people ON people.id = attendances.person_id
JOIN employments ON employments.id = people.current_employment_id
@khalsah
khalsah / deploy.sh
Created January 3, 2012 22:59
Experimental git sync & deploy hooks
#!/bin/sh
LOCAL_BRANCH="master"
LIVE_BRANCH="live"
REMOTE_NAME="deploy"
if [ "$(git symbolic-ref -q HEAD)" != "refs/heads/${LOCAL_BRANCH}" ]; then
echo "Not on ${LOCAL_BRANCH}, not deploying"
exit 1
else

Keybase proof

I hereby claim:

  • I am khalsah on github.
  • I am hargobind (https://keybase.io/hargobind) on keybase.
  • I have a public key whose fingerprint is 7C55 F620 2A40 CA75 7D7A 3FD6 4780 084B 4AB1 5393

To claim this, I am signing this object: