Commit 17075a0b authored by micael.bergeron's avatar micael.bergeron

cache the Note#commit method

parent 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
return commit if for_commit?
super
end
rescue
# Temp fix to prevent app crash
# if note commit id doesn't exist
rescue
nil
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment