1
0
Fork 0
beathaven/app/models/track.rb

15 lines
373 B
Ruby

class Track < ActiveRecord::Base
belongs_to :album
has_many :performers
has_many :artists, through: :performers
attr_accessible :album_id, :disc_id, :duration, :position, :rovi_id, :title
def length
return if duration.nil?
length = duration.divmod(60).map(&:to_s)
length[1] = "0" << length[1] if length[1].length == 1
length.join(":")
end
end