Skip to content

Commit 5c6e9d4

Browse files
committed
Keep rescue template paths in an array
Gotta be honest, this is so I can make some hacks. Basically I would like an engine to specify where to find rescue templates, and currently there's no way to add search paths to the debug view lookup context. This commit turns the template path in to an array (that I plan to mutate, but nobody should do that besides me until we make an actual good API). I added the `dup` in `initialize` so in case the array is accidentally mutated we don't leak memory.
1 parent 876977d commit 5c6e9d4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

actionpack/lib/action_dispatch/middleware/debug_view.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
module ActionDispatch
99
class DebugView < ActionView::Base # :nodoc:
10-
RESCUES_TEMPLATE_PATH = File.expand_path("templates", __dir__)
10+
RESCUES_TEMPLATE_PATHS = [File.expand_path("templates", __dir__)]
1111

1212
def initialize(assigns)
13-
paths = [RESCUES_TEMPLATE_PATH]
13+
paths = RESCUES_TEMPLATE_PATHS.dup
1414
lookup_context = ActionView::LookupContext.new(paths)
1515
super(lookup_context, assigns, nil)
1616
end

railties/lib/rails/info_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require "action_dispatch/routing/inspector"
55

66
class Rails::InfoController < Rails::ApplicationController # :nodoc:
7-
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATH
7+
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS
88
layout -> { request.xhr? ? false : "application" }
99

1010
before_action :require_local!

railties/lib/rails/mailers_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "rails/application_controller"
44

55
class Rails::MailersController < Rails::ApplicationController # :nodoc:
6-
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATH
6+
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS
77

88
around_action :set_locale, only: [:preview, :download]
99
before_action :find_preview, only: [:preview, :download]

0 commit comments

Comments
 (0)