instance method revision

Ruby on Rails edge

Since edge

Signature

revision()

Returns the application’s revision (deployment identifier). Useful for error reporting and deployment verification.

Set via config.revision (string), ENV, or REVISION file. Always either a String or nil.

Source
# File railties/lib/rails/application.rb, line 401
    def revision
      unless @revision_initialized
        @revision = begin
          ENV["REVISION"].presence ||
            root.join("REVISION").read.strip.presence
        rescue SystemCallError
          r, w = IO.pipe
          success = system("git", "-C", root.to_s, "rev-parse", "HEAD", in: File::NULL, err: File::NULL, out: w)
          w.close
          rev = r.read.strip
          r.close
          rev if success
        end
        @revision_initialized = true
      end
      @revision
    end

Defined in railties/lib/rails/application.rb line 401 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Application

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close