You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To begin I'm not sure if this is a turbo-rails 2.x.x issue or all around.
Whenever I attempt to have my rails app render a turbo_stream.replace, the browser instead of rendering the replacement is downloading the raw html file of the actual turbo_stream replacement.
I'm using old code from a few months back from when this was originally working (my gemfile.lock says I was on 1.5.0) back then with a new Rails app that was just scaffold-ed.
When attempting to dive into this and figure out the issue I did find out that window.Turbo is undefined in my console on the Rails app.
My controller code:
exercise_name = exercise_params[:name]
@exercise = Exercise.build(name: exercise_name, user_id: current_user.id)
if @exercise.save
update_exercise_list
else
render exercises_path, status: :unprocessable_entity
end
end
private
def exercise_params
params.require(:exercise).permit(:name, :personal_best)
end
def update_exercise_list
render turbo_stream: turbo_stream.replace('exercise_list',
partial: 'exercises/exercise_list',
locals: { exercises: current_user.exercises.order(name: :asc) })
end
My partial view that contains the turbo frame:
<ul class="mt-5">
<% exercises.each do |exercise| %>
<li>
<%= exercise.name %>
</li>
<% end %>
</ul>
<% end %>
This still works properly in my old project but does not when I force my current project to use 1.5.0. In chrome it doesn't download a file but displays the raw html as text.
To begin I'm not sure if this is a turbo-rails 2.x.x issue or all around.
Whenever I attempt to have my rails app render a turbo_stream.replace, the browser instead of rendering the replacement is downloading the raw html file of the actual turbo_stream replacement.
I'm using old code from a few months back from when this was originally working (my gemfile.lock says I was on 1.5.0) back then with a new Rails app that was just scaffold-ed.
When attempting to dive into this and figure out the issue I did find out that window.Turbo is undefined in my console on the Rails app.
My controller code:
My partial view that contains the turbo frame:
The attached files are what my browser downloads
exercises.txt
exercises(15).txt
The text was updated successfully, but these errors were encountered: