Commit ff40b7de7a6451bb9e3bc12a18070bbff13b6a68
1 parent
8b7e404b
Exists in
master
and in
4 other branches
Add CommitDecorator#short_id
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
app/decorators/commit_decorator.rb
1 | class CommitDecorator < ApplicationDecorator | 1 | class CommitDecorator < ApplicationDecorator |
2 | decorates :commit | 2 | decorates :commit |
3 | 3 | ||
4 | + def short_id(length = 10) | ||
5 | + id.to_s[0..length] | ||
6 | + end | ||
7 | + | ||
4 | # Returns the commits title. | 8 | # Returns the commits title. |
5 | # | 9 | # |
6 | # Usually, the commit title is the first line of the commit message. | 10 | # Usually, the commit title is the first line of the commit message. |