Dom Christie

Today I Learned

First, an interesting idea from Pascal Laliberté to combine Turbo Frames Turbo Streams. Useful if you want update an area outside the Turbo Frame when the frame re-renders.

For example, let’s say your Turbo Frame has a form, and after submission, you want to display a notice somewhere else, the response template might look something like:

<%= turbo_frame_tag :like do %>
  <%= render "form" %>
  <%= turbo_stream.update :notices, notice %>
<% end %>

Second, Rails’ compact_blank does what it says! Works on arrays and hashes. Via Matt Swanson on Twitter.