Thanks – great article! For anyone else new to Rails like me who gets stuck rendering their first Svelte view after following the article here, create/edit these files:
# config/routes.rb
Rails.application.routes.draw do
root 'home#index'
end
# app/controllers/home_controller.rb
class HomeController < ApplicationController
def index
render inertia: 'home/index'
end
end
<!-- app/frontend/pages/home/index.svelte -->
<h1>Home page</h1>
(Feedback appreciated. I don't know if this is the standard "Rails way" or not.)
Thanks – great article! For anyone else new to Rails like me who gets stuck rendering their first Svelte view after following the article here, create/edit these files:
(Feedback appreciated. I don't know if this is the standard "Rails way" or not.)
The component file names are case-sensitive. Try
render inertia: 'home'