inertia-rails
Installation
SKILL.md
<essential_principles>
How Inertia Rails Works
Inertia is a bridge between Rails and modern JavaScript frameworks (React, Vue, Svelte). It lets you build SPAs using classic server-side routing and controllers—no client-side routing or separate APIs needed.
1. Server-Driven Architecture
Controllers render Inertia responses instead of views. Data flows from Rails to JavaScript components as props:
render inertia: 'Users/Show', props: { user: user.as_json }
2. No Client-Side Routing
Routes live in config/routes.rb. Inertia intercepts link clicks and form submissions, making XHR requests that return JSON with component name and props. The client swaps components without full page reloads.
3. Convention-Based Component Resolution
By default, render inertia: { user: } in UsersController#show renders app/frontend/pages/users/show.(jsx|vue|svelte). Override with explicit component names when needed.