Skip to content

Commit 242e73c

Browse files
move locals assignment outside of conditional to allow locals access with inline
1 parent cbd28a2 commit 242e73c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/models/concerns/turbo/broadcastable.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ def broadcast_rendering_with_defaults(options)
310310
options.tap do |o|
311311
# Add the current instance into the locals with the element name (which is the un-namespaced name)
312312
# as the key. This parallels how the ActionView::ObjectRenderer would create a local variable.
313+
o[:locals] = (o[:locals] || {}).reverse_merge!(model_name.element.to_sym => self)
313314
# if the html or inline options are passed it will skip setting a partial from #to_partial_path
314315
unless o.include?(:html) || o.include?(:inline)
315-
o[:locals] = (o[:locals] || {}).reverse_merge!(model_name.element.to_sym => self)
316316
o[:partial] ||= to_partial_path
317317
end
318318
end

0 commit comments

Comments
 (0)