At work we are building a Rails app that’s supposed to run on appliances instead of being hosted by us. To make it easier to deal with bug reports and feature requests, we always display the version number in the footer. A couple of days ago I thought it’d be handy to replace this with the current branch in development mode. Using Grit the solution couldn’t have been any simpler:
1 2 3 4 |
|
Call version_div
in a view and you are good to go. If dragging in another dev dependency for just one call bothers you, you can also shell out to get the current branch: git rev-parse --abbrev-ref HEAD
.