![]() We're going to build the simplest Ruby on Rails app I could come up with, which integrates Hotwire for live frontend updates. However, if you've never used Ruby on Rails before, I think it's best you turn elsewhere until you know the basics of Models, Views, Controllers & Routes. It's a simple tutorial though, so you can still follow along. Note how I said "Hotwire beginner", not "Ruby on Rails beginner" - this isn't a Ruby on Rails tutorial. ![]() Our only focus is using Hotwire in our Ruby on Rails app for live frontend updates. We're going to build the most stripped-back app possible. This article is for the Hotwire beginner, and is the simplest possible introduction to Hotwire. So why did I write this guide? The existing resources for Hotwire are pretty confusing, especially for a Hotwire or Rails beginner. With a couple of brodcasts_to lines in my models, and a few turbo_stream_from helpers in my views, I can build live UIs without any sort of Javascript framework. In the past, I've used Hotwire to power my frontends, and it's been great. There are lots of ways to send broadcasts - today, we're going to focus on automatically sending them when our Post model gets created, updated, deleted. Under the hood, Hotwire uses Action Cable to send messages to the frontend (called broadcasts). Hotwire is a (relatively) new part of Ruby on Rails that allows your Rails frontend to update live and in realtime - in many cases, totally replacing a frontend framework like React or Vue. How does the frontend know what to update?.Hotwiring, Streaming and Turbo-Framing our App
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |