clarion/app/models/track.rb
Petko Bordjukov 89de56d94d Add an initial implementation of the Event model
Initial implementation & specs of the Event model and its children
2014-08-10 21:18:41 +03:00

12 lines
290 B
Ruby

class Track < ActiveRecord::Base
belongs_to :conference
has_many :events
validates :name, presence: true
validates :color, presence: true, format: {with: /\A[a-f0-9]{6}\z/i}
def color=(hex_triplet)
write_attribute :color, hex_triplet.gsub(/\A#/,'') if hex_triplet
end
end