Commit 5e1c63d3f0f0729a1d9d9e19c64b2fef65cc30fb
1 parent
a9f275bc
Exists in
master
and in
4 other branches
Move load_refs out of ApplicationController and into CommitsController
That was the only place it was used.
Showing
2 changed files
with
13 additions
and
11 deletions
Show diff stats
app/controllers/application_controller.rb
@@ -120,16 +120,6 @@ class ApplicationController < ActionController::Base | @@ -120,16 +120,6 @@ class ApplicationController < ActionController::Base | ||
120 | end | 120 | end |
121 | end | 121 | end |
122 | 122 | ||
123 | - def load_refs | ||
124 | - if params[:ref].blank? | ||
125 | - @branch = params[:branch].blank? ? nil : params[:branch] | ||
126 | - @tag = params[:tag].blank? ? nil : params[:tag] | ||
127 | - @ref = @branch || @tag || @project.try(:default_branch) || 'master' | ||
128 | - else | ||
129 | - @ref = params[:ref] | ||
130 | - end | ||
131 | - end | ||
132 | - | ||
133 | def render_404 | 123 | def render_404 |
134 | render file: File.join(Rails.root, "public", "404"), layout: false, status: "404" | 124 | render file: File.join(Rails.root, "public", "404"), layout: false, status: "404" |
135 | end | 125 | end |
app/controllers/commits_controller.rb
@@ -59,7 +59,7 @@ class CommitsController < ApplicationController | @@ -59,7 +59,7 @@ class CommitsController < ApplicationController | ||
59 | 59 | ||
60 | def patch | 60 | def patch |
61 | @commit = project.commit(params[:id]) | 61 | @commit = project.commit(params[:id]) |
62 | - | 62 | + |
63 | send_data( | 63 | send_data( |
64 | @commit.to_patch, | 64 | @commit.to_patch, |
65 | type: "text/plain", | 65 | type: "text/plain", |
@@ -67,4 +67,16 @@ class CommitsController < ApplicationController | @@ -67,4 +67,16 @@ class CommitsController < ApplicationController | ||
67 | filename: (@commit.id.to_s + ".patch") | 67 | filename: (@commit.id.to_s + ".patch") |
68 | ) | 68 | ) |
69 | end | 69 | end |
70 | + | ||
71 | + protected | ||
72 | + | ||
73 | + def load_refs | ||
74 | + if params[:ref].blank? | ||
75 | + @branch = params[:branch].blank? ? nil : params[:branch] | ||
76 | + @tag = params[:tag].blank? ? nil : params[:tag] | ||
77 | + @ref = @branch || @tag || @project.try(:default_branch) || 'master' | ||
78 | + else | ||
79 | + @ref = params[:ref] | ||
80 | + end | ||
81 | + end | ||
70 | end | 82 | end |