lib/rafters/component_renderer.rb in rafters-0.0.5 vs lib/rafters/component_renderer.rb in rafters-0.1.0

- old
+ new

@@ -10,11 +10,19 @@ def render(component, template_name = nil) component.controller = @controller template_name = (template_name || component.template_name) - @controller.view_context.render({ - file: "/#{template_name}", - locals: component.attributes - }) + store(component) + + @controller.view_context.content_tag(:div, class: "component", id: component.identifier) do + @controller.view_context.render(file: "/#{template_name}", locals: component.attributes) + end + end + + private + + def store(component) + @controller.rendered_components ||= {} + @controller.rendered_components.merge!(component.as_json) end end