class Issue < ApplicationRecord
  belongs_to :project
  belongs_to :tracker
  belongs_to :issue_tag, foreign_key: :priority_id
  belongs_to :version, foreign_key: :fixed_version_id
  belongs_to :user,optional: true

  scope :issue_includes, ->{includes(:user)}

  def get_assign_user
    User.select(:login, :lastname,:firstname, :nickname)&.find_by_id(self.assigned_to_id)
  end
end