Skip to content

Instantly share code, notes, and snippets.

@pkqk
Created June 11, 2013 16:11
Show Gist options
  • Select an option

  • Save pkqk/5758229 to your computer and use it in GitHub Desktop.

Select an option

Save pkqk/5758229 to your computer and use it in GitHub Desktop.
use a database based on branch name then when you make a new branch rake db:{create,migrate,seed}
database: &database
adapter: # your database
hostname: localhost
username: root
password:
encoding: utf8
development:
<<: *database
<% branch_name = `git symbolic-ref HEAD`.strip.split('/')[-1] %>
<% unless %w[master production staging].include?(branch_name) %>
database: appname_<%= branch_name %>
<% else %>
database: appname_development
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment