issue.rb 1.01 KB
Newer Older
gitlabhq's avatar
gitlabhq committed
1
class Issue < ActiveRecord::Base
2
  include IssueCommonality
3
  include Votes
4

5 6
  acts_as_taggable_on :labels

7
  belongs_to :milestone
8

Steven Verbeek's avatar
Steven Verbeek committed
9
  validates :description,
10
            length: { within: 0..2000 }
Nihad Abbasov's avatar
Nihad Abbasov committed
11

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
12 13 14 15
  def self.open_for(user)
    opened.assigned(user)
  end

randx's avatar
randx committed
16 17 18 19
  def is_assigned?
    !!assignee_id
  end

20 21 22
  def is_being_reassigned?
    assignee_id_changed?
  end
23 24 25 26

  def is_being_closed?
    closed_changed? && closed
  end
27 28 29 30

  def is_being_reopened?
    closed_changed? && !closed
  end
gitlabhq's avatar
gitlabhq committed
31 32 33 34 35
end
# == Schema Information
#
# Table name: issues
#
randx's avatar
randx committed
36 37 38 39 40 41 42 43 44 45 46 47 48
#  id           :integer(4)      not null, primary key
#  title        :string(255)
#  assignee_id  :integer(4)
#  author_id    :integer(4)
#  project_id   :integer(4)
#  created_at   :datetime        not null
#  updated_at   :datetime        not null
#  closed       :boolean(1)      default(FALSE), not null
#  position     :integer(4)      default(0)
#  critical     :boolean(1)      default(FALSE), not null
#  branch_name  :string(255)
#  description  :text
#  milestone_id :integer(4)
gitlabhq's avatar
gitlabhq committed
49 50
#