2012-02-21 20:28:04 +00:00
|
|
|
class Label < ActiveRecord::Base
|
2012-02-23 14:48:31 +00:00
|
|
|
has_many :labelings, :dependent => :destroy
|
2012-02-21 20:28:04 +00:00
|
|
|
has_many :issues, :through => :labelings
|
2012-02-23 14:48:31 +00:00
|
|
|
belongs_to :project
|
2012-02-20 18:41:40 +00:00
|
|
|
|
2012-02-23 14:48:31 +00:00
|
|
|
validates :name, :uniqueness => { :scope => :project_id}
|
2012-02-20 18:41:40 +00:00
|
|
|
validates :name, :color, :presence => true
|
|
|
|
validates :color, :format => { :with => /\A([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})\z/, :message => I18n.t('layout.issues.invalid_labels')}
|
2012-03-07 13:36:17 +00:00
|
|
|
|
2012-02-20 18:41:40 +00:00
|
|
|
end
|