meg-gutshall

meg-gutshall

Modern Front-End Development for Rails, Second Edition - Wording (p 34)

The wording for this paragraph is a bit confusing:

A feature that makes using Turbo Streams easier from the controller side is that Rails recognizes turbo_stream as a format in the same way it recognizes html and json. The Rails controller can then use respond_to. Within your respond_to block, Rails recognizes turbo_stream as a format. As a format, that means that you can use format.turbo_stream to specify response behavior specific to Turbo requests. Rails will also automatically use a file with turbo_stream as the format, the way it does for HTML and JSON, so it looks for a file named <action>.turbo_stream.erb. When Rails recognizes that the request is a Turbo Stream, it does not use the layout when it returns the response on the theory that a Turbo response will only be interested in the body part of the page anyway. This is a small but helpful performance benefit.

I suggest something like:

A feature that makes using Turbo Streams easier from the controller side is
that Rails recognizes turbo_stream as a format in the same way it recognizes
html and json. This means that you can use format.turbo_stream to specify response behavior specific to Turbo requests within your respond_to block. In doing so, Rails will also automatically look for a file named <action>.turbo_stream.erb. When Rails recognizes that the request is a Turbo Stream, it does not use the layout when it returns the response on the theory that a Turbo response will only be interested in the body part of the page anyway. This is a small but helpful performance benefit.

Popular Prag Prog topics Top

iPaul
page 37 ANTLRInputStream input = new ANTLRInputStream(is); as of ANTLR 4 .8 should be: CharStream stream = CharStreams.fromStream(i...
New
Razor54672
The answer to 3rd Problem of Chapter 5 (Making Choices) of “Practical Programming, Third Edition” seems incorrect in the given answer ke...
New
yulkin
your book suggests to use Image.toByteData() to convert image to bytes, however I get the following error: "the getter ‘toByteData’ isn’t...
New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=&gt; (create-...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
jeremyhuiskamp
Title: Web Development with Clojure, Third Edition, vB17.0 (p9) The create table guestbook syntax suggested doesn’t seem to be accepted ...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
oaklandgit
Hi, I completed chapter 6 but am getting the following error when running: thread 'main' panicked at 'Failed to load texture: IoError(O...
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
New
New

Other popular topics Top

siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
New
AstonJ
Curious to know which languages and frameworks you’re all thinking about learning next :upside_down_face: Perhaps if there’s enough peop...
New
AstonJ
Thanks to @foxtrottwist’s and @Tomas’s posts in this thread: Poll: Which code editor do you use? I bought Onivim! :nerd_face: https://on...
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
New
Exadra37
Oh just spent so much time on this to discover now that RancherOS is in end of life but Rancher is refusing to mark the Github repo as su...
New
PragmaticBookshelf
Author Spotlight James Stanier @jstanier James Stanier, author of Effective Remote Work , discusses how to rethink the office as we e...
New
New
PragmaticBookshelf
Author Spotlight Jamis Buck @jamis This month, we have the pleasure of spotlighting author Jamis Buck, who has written Mazes for Prog...
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File &gt; New Rule: And select Deny, O...
New

Latest in PragProg

View all threads ❯