mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
136b814144
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>
24 lines
469 B
Ruby
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
|