turbo-fetch
Turbo Fetch Skill
This skill documents the turbo fetch pattern for dynamically updating form fields based on user input using Turbo Streams and Stimulus.
When to Use
Use turbo fetch when you need to:
- Update form options based on another field's selection
- Show/hide conditional fields dynamically
- Refresh parts of a form without reloading the entire page
- Implement cascading dropdowns or dependent fields
Pattern Overview
The turbo fetch pattern consists of four components:
- Routes - A routing concern that adds the turbo_fetch endpoint
- Controller Action - A backend action that prepares data and renders turbo streams
- Stimulus Controller - Frontend controller that triggers PATCH requests
More from rolemodel/rolemodel-skills
bem-structure
Expert guidance for writing, refactoring, and structuring CSS using BEM (Block Element Modifier) methodology. Provides proper CSS class naming conventions, component structure, and Optics design system integration for maintainable, scalable stylesheets.
86optics-context
Use the Optics design framework for styling applications. Apply Optics classes for layout, spacing, typography, colors, and components. Use when working on CSS, styling views, or implementing design system guidelines.
39routing-patterns
Review, generate, and update Rails routes following professional patterns and best practices. Covers RESTful resource routing, route concerns for code reusability, shallow nesting strategies, and advanced route configurations.
30stimulus-controllers
Create and register Stimulus controllers for interactive JavaScript features. Use when adding client-side interactivity, dynamic UI updates, or when the user mentions Stimulus controllers or JavaScript behavior.
27controller-patterns
Review and update existing Rails controllers and generate new controllers following professional patterns and best practices. Covers RESTful conventions, authorization patterns, proper error handling, and maintainable code organization.
27testing-patterns
Write automated tests using RSpec, Capybara, and FactoryBot for Rails applications. Use when implementing features, fixing bugs, or when the user mentions testing, specs, RSpec, Capybara, or test data. Avoid using rails console or server for testing.
27