From ff40b7de7a6451bb9e3bc12a18070bbff13b6a68 Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Sat, 21 Jul 2012 19:37:31 +0200 Subject: [PATCH] Add CommitDecorator#short_id --- app/decorators/commit_decorator.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/decorators/commit_decorator.rb b/app/decorators/commit_decorator.rb index cc8fa97587b..d9c880bee72 100644 --- a/app/decorators/commit_decorator.rb +++ b/app/decorators/commit_decorator.rb @@ -1,6 +1,10 @@ class CommitDecorator < ApplicationDecorator decorates :commit + def short_id(length = 10) + id.to_s[0..length] + end + # Returns the commits title. # # Usually, the commit title is the first line of the commit message. -- GitLab