forgeplus/app/models/pull_request.rb

16 lines
571 B
Ruby
Raw Permalink Normal View History

2020-03-09 00:40:16 +08:00
class PullRequest < ApplicationRecord
#status 0 默认未合并, 1表示合并, 2表示请求拒绝
belongs_to :issue
belongs_to :user
belongs_to :project, :counter_cache => true
2020-06-30 09:44:28 +08:00
# belongs_to :fork_project, foreign_key: :fork_project_id
2020-03-09 00:40:16 +08:00
has_many :pull_request_assigns, foreign_key: :pull_request_id
has_many :pull_request_tags, foreign_key: :pull_request_id
has_many :project_trends, as: :trend, dependent: :destroy
has_many :attachments, as: :container, dependent: :destroy
2020-06-30 09:44:28 +08:00
def fork_project
Project.find_by(id: self.fork_project_id)
end
2020-03-09 00:40:16 +08:00
end