From 458631c5ba8c830021bd7c219affdb0afe6f0efe Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Sun, 31 Mar 2013 23:58:17 +0300 Subject: [PATCH] remove unnecessary Commit.new --- app/contexts/commit_load_context.rb | 1 - app/helpers/commits_helper.rb | 4 +--- app/models/note.rb | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/contexts/commit_load_context.rb b/app/contexts/commit_load_context.rb index a0652377..2cf5420d 100644 --- a/app/contexts/commit_load_context.rb +++ b/app/contexts/commit_load_context.rb @@ -12,7 +12,6 @@ class CommitLoadContext < BaseContext commit = project.repository.commit(params[:id]) if commit - commit = Commit.new(commit) line_notes = project.notes.for_commit_id(commit.id).inline result[:commit] = commit diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index da209e06..66603c97 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -109,9 +109,7 @@ module CommitsHelper end def commit_to_html commit - if commit.model - escape_javascript(render 'commits/commit', commit: commit) - end + escape_javascript(render 'commits/commit', commit: commit) end def diff_line_content(line) diff --git a/app/models/note.rb b/app/models/note.rb index 17ceb541..f26420ca 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -130,7 +130,7 @@ class Note < ActiveRecord::Base # override to return commits, which are not active record def noteable if for_commit? - Commit.new(project.repository.commit(commit_id)) + project.repository.commit(commit_id) else super end