lib/pakyow/plugin/helpers/rendering.rb in pakyow-presenter-1.0.0.rc2 vs lib/pakyow/plugin/helpers/rendering.rb in pakyow-presenter-1.0.0.rc3

- old
+ new

@@ -7,11 +7,24 @@ module Helpers module Rendering extend Support::Extension prepend_methods do - def render(path = @connection.get(:__endpoint_path) || @connection.path, *args) - super(File.join(@connection.app.class.mount_path, path), *args) + def render(view_path = nil, as: nil, modes: [:default]) + super(File.join(@connection.app.class.mount_path, view_path), as: as, modes: modes) + rescue Presenter::UnknownPage + # Try rendering the view from the app. + # + connection = @connection.app.parent.isolated(:Connection).from_connection( + @connection, :@app => @connection.app.parent + ) + + connection.app.isolated(:Renderer).render( + connection, + view_path: view_path, + presenter_path: as, + modes: modes + ) end end end end end