Add CommitDecorator#short_id

This commit is contained in:
Riyad Preukschas 2012-07-21 19:37:31 +02:00
parent 8b7e404b5b
commit ff40b7de7a

View file

@ -1,6 +1,10 @@
class CommitDecorator < ApplicationDecorator class CommitDecorator < ApplicationDecorator
decorates :commit decorates :commit
def short_id(length = 10)
id.to_s[0..length]
end
# Returns the commits title. # Returns the commits title.
# #
# Usually, the commit title is the first line of the commit message. # Usually, the commit title is the first line of the commit message.