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 | 120 | end |
121 | 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 | 123 | def render_404 |
134 | 124 | render file: File.join(Rails.root, "public", "404"), layout: false, status: "404" |
135 | 125 | end | ... | ... |
app/controllers/commits_controller.rb
... | ... | @@ -59,7 +59,7 @@ class CommitsController < ApplicationController |
59 | 59 | |
60 | 60 | def patch |
61 | 61 | @commit = project.commit(params[:id]) |
62 | - | |
62 | + | |
63 | 63 | send_data( |
64 | 64 | @commit.to_patch, |
65 | 65 | type: "text/plain", |
... | ... | @@ -67,4 +67,16 @@ class CommitsController < ApplicationController |
67 | 67 | filename: (@commit.id.to_s + ".patch") |
68 | 68 | ) |
69 | 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 | 82 | end | ... | ... |