Hi there,
I have the following situation, an aside
with some links, a table and a button that relies on the @plan
variable to be rendered or not.
When clicking one of the link, an action is triggered with turbo stream
format.
def index
@items = Item.where(phase_id: params[:phase_id])
end
The view looks like (items is the ID of the tbody
element within the table on the right).
<%= turbo_stream.update "items" do %>
<%= render partial: "masterdata/item", collection: @items, as: :item %>
<% end %>
When I click on the aside
links I get an error because the @plan
variable is not defined and Rails doesn’t know how if it has to render the button. The code responsible to render the button looks like
<% if @plan.active? %>
<%= tag.button ... %>
<% end %>
Shouldn’t the turbo stream
action only replace the content within #items
without caring about the rest of the page?
Thanks,