We don't have a turbo_stream.morph helper yet?

I am trying to do something like this,

# toggle.turbo_stream.erb
<%= turbo_stream.morph "completed_todos_section" do %>
  <%= render partial: "some_model/completed_todos", locals: {todos: @completed_todos } %>
<% end %>

and it results in

Showing app/views/todos/toggle.turbo_stream.erb where line #3 raised:
undefined method `morph' for #<Turbo::Streams::TagBuilder:0x00007f314f0d5908 @view_context=#<ActionView::Base:0x000000000529e0>>

So, we don’t have a helper method for morphing right now?

We do have a morph helper method. So why isn’t it working?

1 Like

Nevermind, it was added 3 days ago.

To resolve this temporarily,

  1. Add this to your Gemfile:
gem 'turbo-rails', git: 'https://github.com/hotwired/turbo-rails.git', branch: 'main'
  1. Run:
bundle install
2 Likes