Ask A Question

Notifications

You’re not receiving notifications from this thread.

Hotwire Not Working Inside of Namespace

Brian Gilbank asked in Rails

This seems like an easy fix, but I am not sure why its not working. I have an admin dashboard using Hotwire, but I can't seem to create records for my gym model (There are no errors, and it will work when I refresh). I can create records outside the namespace using the same model though, and using the same setup as below.

Do I need to pass the namespace in with the dom_id for Hotwire to work? Or is it an issue with the form_with namespace?

example namespace form
<%= form_with(model: [:dashboard, gym]) do |f| %>
 *fields
<% end %>

_gym.html.erb
<div id="<%= dom_id gym %>" class="card">
 *content
</div>

show.html.erb
<%= render @gym %>
Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 71,728+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.