2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

見せる Git revision in Rails app

Last updated at Posted at 2013-04-03

用いるgit-revision gem.

Gemfile
gem 'git-revision'
app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
  protect_from_forgery

  before_filter :set_git_header

  private

  def set_git_header
    response.headers['X-Git-Revision'] = Git::Revision.info[:commit_hash_short]
  end
end

置くcustom X-Git-Revision headerとlast commit sha.

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?