summaryrefslogtreecommitdiff
path: root/app/models/label.rb
blob: 31f68c31e5c4f975d6ab171f75e2e39e74d1cf22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
class Label < ActiveRecord::Base
  belongs_to :project
  has_many :label_links, dependent: :destroy

  validates :color, format: { with: /\A\#[0-9A-Fa-f]{3}{1,2}+\Z/ }, allow_blank: true
  validates :project, presence: true
  validates :title, presence: true

  def name
    title
  end
end