Skip to content
Snippets Groups Projects
Commit 17075a0b authored by micael.bergeron's avatar micael.bergeron
Browse files

cache the Note#commit method

parent 16c8b910
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment