diff --git a/lib/action_prompt/renderer.rb b/lib/action_prompt/renderer.rb index 09d6526..b868562 100644 --- a/lib/action_prompt/renderer.rb +++ b/lib/action_prompt/renderer.rb @@ -1,13 +1,12 @@ module ActionPrompt class Renderer def initialize - # NOOP + @controller = ApplicationController.new + @controller.prepend_view_path(Rails.root.join("app", "prompts")) end def render(template_name, locals: {}) - controller = ApplicationController.new - controller.prepend_view_path(Rails.root.join("app", "prompts")) - controller.render_to_string(template: template_name, locals: locals, layout: false) + @controller.render_to_string(template: template_name, locals: locals, layout: false) end end end