Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Per-branch development database with Git and Ruby on Rails.
DEFAULT_DB = 'myapp_development'
DB_BRANCHES = %w[ t79 ]
branch = `git symbolic-ref HEAD 2> /dev/null`.chomp.split('/').last
dev_db = DB_BRANCHES.include?(branch) ? branch.gsub(/[^a-zA-Z0-9_]/, '') : DEFAULT_DB
puts "Using dev database: #{dev_db.inspect}"
database: <%= dev_db %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.