提交 17075a0b 编写于 作者: M micael.bergeron

cache the Note#commit method

上级 16c8b910
......@@ -231,19 +231,17 @@ class Note < ActiveRecord::Base
end
def commit
project.commit(commit_id) if commit_id.present?
@commit ||= project.commit(commit_id) if commit_id.present?
end
# override to return commits, which are not active record
def noteable
if for_commit?
@commit ||= commit
else
super
end
# Temp fix to prevent app crash
# if note commit id doesn't exist
return commit if for_commit?
super
rescue
# Temp fix to prevent app crash
# if note commit id doesn't exist
nil
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册