Skip to content

Commit fedaf03

Browse files
Merge pull request rails#47728 from p8/docs/health-controller
Use explicit module for Rails::HealthController
2 parents ba19dbc + 51c4179 commit fedaf03

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

railties/lib/rails/health_controller.rb

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,25 @@
3131
# where your application is being restarted due to a third-party service going
3232
# bad. Ideally, you should design your application to handle those outages
3333
# gracefully.
34-
class Rails::HealthController < ActionController::Base
35-
rescue_from(Exception) { render_down }
34+
module Rails
35+
class HealthController < ActionController::Base
36+
rescue_from(Exception) { render_down }
3637

37-
def show
38-
render_up
39-
end
40-
41-
private
42-
def render_up
43-
render html: html_status(color: "green")
38+
def show
39+
render_up
4440
end
4541

46-
def render_down
47-
render html: html_status(color: "red"), status: 500
48-
end
42+
private
43+
def render_up
44+
render html: html_status(color: "green")
45+
end
4946

50-
def html_status(color:)
51-
%(<html><body style="background-color: #{color}"></body></html>).html_safe
52-
end
47+
def render_down
48+
render html: html_status(color: "red"), status: 500
49+
end
50+
51+
def html_status(color:)
52+
%(<html><body style="background-color: #{color}"></body></html>).html_safe
53+
end
54+
end
5355
end

0 commit comments

Comments
 (0)