1 require_dependency 'lyric_parser'
3 class Song < ActiveRecord::Base
4 belongs_to :user, :dependent => :destroy
5 has_many :usages, :dependent => :destroy
6 has_many :shows, :through => :usages
8 # The entire UI breaks down without a title
9 validates_presence_of :title
11 # Split the song into slides.
13 # Slides are separated by a blank line, indicated
14 # by two new-line characters. The parser is pretty
15 # tolerant of whitespace. See the RSpecs for examples.
17 Lyrix::LyricParser.new(lyrics).to_slides
21 attributes["artist"] || ''