filmov
tv
Hotwire Comments with Ruby on Rails

Показать описание
Hotwire is a library that brings real-time functionality to your Rails applications. By integrating Hotwire-enabled comments, you can create a more interactive and immersive experience for your readers. That’s our focus today.
With Hotwire, we can enhance a typical blob comment with Rails in the following ways:
- Enable real-time commenting without page reloads
- Display new comments as they are posted.
- Update comment counts dynamically.
- Enhance user engagement and encourage discussion.
- Delete and edit comments without reloading pages
### What I hope you'll learn in this tutorial:
This tutorial will guide you through adding Hotwire-enabled comments to a simple Rails blog application. You'll learn how to:
- Create a basic blog with Rails 7.1
- Create a comment model and controller.
- Build a comment form with Hotwire.
- Display and update comments in real time.
**Some prerequisites:**
- A Rails 7 application (Hotwire is compatible with Rails 7 and later)
- Basic knowledge of Rails and JavaScript
Let's get started!
Timestamps:
00:00 - What we plan to build
01:02 - rails new hotwire_comments
01:30 - Install Rails UI and configure template to use
04:35 - Scaffolding Models (Post and Comment)
06:50 - Migrate database
07:15 - Establish model relationships
08:11 - Add simple model validations
11:10 - PostsController logic
12:52 - Initialize new comment on posts show action
14:17 - Generate comments controller
15:25 - Update routes again
16:57 - Add comment form to posts show page
21:00 - Comments controller logic
26:00 - Update view to display comment list
27:58 - Transitioning to Hotwire comments
33:09 - Respond with turbo_streams
34:00 - Adding turbo_stream actions
40:00 - Real-time editing of comments
42:40 - Update comments controller to add, edit, update, and destroy actions
49:17 - Final demo!
50:11 - I'm making a new FREE Hotwire course!
======
💻 Read the written version:
💎 New to Ruby on Rails? Enroll in my course HELLO RAILS:
Additional Links:
P.S. This stuff takes a long time to make but I love to do it. To help me keep at it consider supporting me. If not monetarily, subscribe to the channel or share it with someone!
With Hotwire, we can enhance a typical blob comment with Rails in the following ways:
- Enable real-time commenting without page reloads
- Display new comments as they are posted.
- Update comment counts dynamically.
- Enhance user engagement and encourage discussion.
- Delete and edit comments without reloading pages
### What I hope you'll learn in this tutorial:
This tutorial will guide you through adding Hotwire-enabled comments to a simple Rails blog application. You'll learn how to:
- Create a basic blog with Rails 7.1
- Create a comment model and controller.
- Build a comment form with Hotwire.
- Display and update comments in real time.
**Some prerequisites:**
- A Rails 7 application (Hotwire is compatible with Rails 7 and later)
- Basic knowledge of Rails and JavaScript
Let's get started!
Timestamps:
00:00 - What we plan to build
01:02 - rails new hotwire_comments
01:30 - Install Rails UI and configure template to use
04:35 - Scaffolding Models (Post and Comment)
06:50 - Migrate database
07:15 - Establish model relationships
08:11 - Add simple model validations
11:10 - PostsController logic
12:52 - Initialize new comment on posts show action
14:17 - Generate comments controller
15:25 - Update routes again
16:57 - Add comment form to posts show page
21:00 - Comments controller logic
26:00 - Update view to display comment list
27:58 - Transitioning to Hotwire comments
33:09 - Respond with turbo_streams
34:00 - Adding turbo_stream actions
40:00 - Real-time editing of comments
42:40 - Update comments controller to add, edit, update, and destroy actions
49:17 - Final demo!
50:11 - I'm making a new FREE Hotwire course!
======
💻 Read the written version:
💎 New to Ruby on Rails? Enroll in my course HELLO RAILS:
Additional Links:
P.S. This stuff takes a long time to make but I love to do it. To help me keep at it consider supporting me. If not monetarily, subscribe to the channel or share it with someone!
Комментарии