Module: TurboCable::StreamsHelper

Defined in:
app/helpers/turbo_cable/streams_helper.rb

Instance Method Summary collapse

Instance Method Details

#turbo_stream_from(*stream_names) ⇒ Object

Custom turbo_stream_from that works with our WebSocket implementation Drop-in replacement for Turbo Stream's turbo_stream_from helper



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/turbo_cable/streams_helper.rb', line 5

def turbo_stream_from(*stream_names)
  streams_str = stream_names.join(",")
  Rails.logger.debug "[TurboCable] turbo_stream_from rendering marker for streams: #{streams_str}"

  # Create a marker element that JavaScript will find and subscribe to
  tag.div(
    data: {
      turbo_stream: true,
      streams: streams_str
    },
    style: "display: none;"
  )
end