1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionview/lib/action_view/template/renderable.rb
Joel Hawksley 136b814144 Include layout when rendering objects from controllers
In https://github.com/rails/rails/pull/37919, support
for rendering objects that respond_to render_in in
controllers was added. However, the implementation
did not support layouts.

This change updates the implementation from #37919
to more closely match the rest of the
ActionView::Template classes, enabling the use of layouts.

Co-authored-by: Felipe Sateler <fsateler@gmail.com>
2020-10-14 11:49:45 -06:00

24 lines
469 B
Ruby

# frozen_string_literal: true
module ActionView
# = Action View Renderable Template for objects that respond to #render_in
class Template
class Renderable # :nodoc:
def initialize(renderable)
@renderable = renderable
end
def identifier
@renderable.class.name
end
def render(context, *args)
@renderable.render_in(context)
end
def format
@renderable.format
end
end
end
end