Search⌘ K
AI Features

Adding Real Features

Explore how to integrate client-side functionality in Rails applications by using TypeScript to create interactive elements like show/hide toggles. Learn how to manage state, handle events, and work with Turbolinks to improve page responsiveness. Understand the basics of class-based code structure and type annotations to maintain code quality.

If you’ve looked at the schedule page in your browser, you’ll see a button next to each day in the schedule labeled “Hide.” Clicking on it does nothing—yet.

Toggling the state with TypeScript

If you’ve looked at the markup for that page in app/views/schedule/show.html.erb, you’ll see an each loop for each day in the schedule. A few lines into that loop, you’ll see ...