Module: Upkeep::Rails::ActionViewCapture::TurboFrameHelperHook

Defined in:
lib/upkeep/rails/action_view_capture.rb

Instance Method Summary collapse

Instance Method Details

#turbo_frame_tag(*ids, src: nil, target: nil, **attributes, &block) ⇒ Object



598
599
600
601
602
603
604
605
606
607
608
609
610
# File 'lib/upkeep/rails/action_view_capture.rb', line 598

def turbo_frame_tag(*ids, src: nil, target: nil, **attributes, &block)
  return super unless block

  target_id = if ids.first.respond_to?(:to_key) || ids.first.is_a?(Class)
    ActionView::RecordIdentifier.dom_id(*ids)
  else
    ids.join("_")
  end

  super(*ids, src: src, target: target, **attributes) do
    ActionViewCapture.capture_turbo_frame(self, target_id) { block.call }
  end
end