[#19] fix error with undefined method `project`

This commit is contained in:
Alexander Machehin 2013-04-10 18:26:23 +06:00
parent 957b411154
commit 266ae36296
2 changed files with 3 additions and 6 deletions

View File

@ -15,6 +15,7 @@ class CommentPresenter < ApplicationPresenter
else
issue = Issue.where(:id => comment.created_from_issue_id).first
@referenced_issue = issue.pull_request || issue
@reference_project = issue.project
if issue && (comment.data[:comment_id].nil? || Comment.exists?(comment.data[:comment_id]))
title = if issue == opts[:commentable]
"#{issue.serial_id}"
@ -111,8 +112,4 @@ class CommentPresenter < ApplicationPresenter
pull_status_label @referenced_issue
end.html_safe
end
def reference_project
@referenced_issue.project
end
end

View File

@ -4,7 +4,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
attr_accessor :commit
attr_reader :header, :image, :date, :caption, :content, :expandable,
:is_reference_to_issue, :committer, :reference_project
:is_reference_to_issue, :committer
def initialize(commit, opts = {})
comment = opts[:comment]
@ -78,7 +78,7 @@ class GitPresenters::CommitAsMessagePresenter < ApplicationPresenter
end
def reference_project
@project
@project if @is_reference_to_issue
end
protected