Skip to content

Commit

Permalink
use helper_method for turbo_frame_request_id (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkasyanchuk authored Jun 24, 2023
1 parent c230ba9 commit 5e9bc1f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/controllers/turbo/frames/frame_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ module Turbo::Frames::FrameRequest
included do
layout -> { "turbo_rails/frame" if turbo_frame_request? }
etag { :frame if turbo_frame_request? }

helper_method :turbo_frame_request_id
end

private
Expand Down
1 change: 0 additions & 1 deletion test/dummy/app/controllers/trays_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class TraysController < ApplicationController
def show
@frame_id = turbo_frame_request_id
end

def create
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/app/views/trays/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

<turbo-frame id="tray">
<div>This is a tray!</div>
<div><%= @frame_id %></div>
<div><%= turbo_frame_request_id %></div>
</turbo-frame>

0 comments on commit 5e9bc1f

Please sign in to comment.