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 ...@@ -231,19 +231,17 @@ class Note < ActiveRecord::Base
end end
def commit def commit
project.commit(commit_id) if commit_id.present? @commit ||= project.commit(commit_id) if commit_id.present?
end end
# override to return commits, which are not active record # override to return commits, which are not active record
def noteable def noteable
if for_commit? return commit if for_commit?
@commit ||= commit
else super
super
end
# Temp fix to prevent app crash
# if note commit id doesn't exist
rescue rescue
# Temp fix to prevent app crash
# if note commit id doesn't exist
nil nil
end 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