Add CommitDecorator#short_id

This commit is contained in:
Riyad Preukschas
2012-07-21 19:59:55 +02:00
parent 8b7e404b5b
commit ff40b7de7a
+4
View File
@@ -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.