Class: RailsRenderService::TemplateResolver

Inherits:
ActionView::Resolver
  • Object
show all
Defined in:
lib/rails_render_service/template_resolver.rb

Instance Method Summary collapse

Instance Method Details

#find_templates(name, prefix, partial, details, throwaway_flag = false) ⇒ Object

See https://github.com/rails/rails/issues/23243 re: throwaway_flag



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rails_render_service/template_resolver.rb', line 4

def find_templates(name, prefix, partial, details, throwaway_flag=false)
  path = "#{prefix}/#{name}"
  if details[:formats].include?(:html) && Renderer.has_template(path)
    [::ActionView::Template.new(
      "<%= render_service('#{path}') %>",
      "Revelry - #{path}",
      ActionView::Template.registered_template_handler(:erb),
      {
        format: Mime[:erb],
        virtual_path: path
      }
    )]
  else
    []
  end
end