Render Phlex pages from controllers

Render an instance of a Phlex view from a controller action.

class ProfileController < ApplicationController
  before_action { @user = User.find(params.fetch(:id)) }

  def show
    respond_to do |format|
      format.html { render Views::Profile.new(user: @user) }
    end
  end
end
18 / 39