Refactoring JQuery AJAX requests into Hotwire Turbo in Rails 6 👨🏽‍💻 Freestyle Coding!

preview_player
Показать описание
If you came to see the AJAX vs Turbo deliberation without background context, skip to 9:19

0:00 Intro & the plan (gonna freestyle it)
2:37 Pros and cons of serving dynamic images out of /public
5:36 Refactoring the HAML template to Slim
6:17 How I use the BEM convention in my CSS
7:37 First attempt at refactoring the old JQuery code into Hotwire/Stimulus
9:19 Dilemma - AJAX or no AJAX with Hotwire? What's the best practice?
11:54 Setting up an async frontend request to be handled purely by Turbo/Rails
13:00 Why I only render one instance variable per Rails controller action
13:54 Turbo Streams error handling is not so great when you get a 500 server error
15:38 Rails can't distinguish when to render a Turbo stream response vs render a full page
17:19 Got the Turbo stream request implemented... kinda 😒

Background Music:
Creative Commons — Attribution-ShareAlike 3.0 Unported — CC BY-SA 3.0

Stock footage:
Рекомендации по теме
join shbcf.ru