label.rb 372 Bytes
Newer Older
1
2
3
4
class Label < ActiveRecord::Base
  belongs_to :project
  has_many :label_links, dependent: :destroy

5
  validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true
6
  validates :project, presence: true
7
8
9

  # Dont allow '?', '&', and ',' for label titles
  validates :title, presence: true, format: { with: /\A[^&\?,&]*\z/ }
10
11
12
13

  def name
    title
  end
14
end