Questions tagged [hotwire-rails]

Hotwire-rails is a collection of front-end tools for Rails available since Rails 6 and enabled by default in Rails 7. Use the [Hotwire-rails] tag for questions about Stimulus, Turbo Drive, Turbo Frames and Turbo Streams and especially their usage in Rails. This tag is not for turbo-links (unless the question is about updating to Hotwire). Also be aware that Hotwire and its components are sometimes used outside of Rails.

See also:

228 questions
0
votes
0 answers

Turbo frame appends response to html tag instead of using target

After successful submit it should reload the page (_top) instead it appends the pages index to the html tag. application.js import "@hotwired/turbo-rails" application.html.erb New Page <%=…
Oliver
  • 801
  • 13
  • 26
0
votes
0 answers

Ruby on Rails 7 - page loaded twice when use 'data-turbo-track': 'reload' on it

I use rails 7 with importmap. On view I added <% content_for :head do %> <%= javascript_include_tag 'path/to/script', 'data-turbo-track': 'reload' %> <% end %> for run script only on it. After that the page is always loaded twice when you go to…
0
votes
0 answers

Rails 7 + Hotwire/Turbo: `turbo_frame_tag` not rendering where it should

I'm creating a table and I want to render a turbo-frame tag around each row. Here's the code in an html.erb file (see line 7). 1. 2. 3. ... 4. 5. 6. <%…
John
  • 9,254
  • 12
  • 54
  • 75
0
votes
1 answer

Rails 7 using hotwire to replace a form element

Context: a form has a collection_select, but without a value that interests the user. A second form allows to create a new entry that would populate the collection_select with a desired value. Class Article has_many :tags The create turbostream…
Jerome
  • 5,583
  • 3
  • 33
  • 76
0
votes
1 answer

Nil location provided. Can't build URI error with project tasks turbo stream

I have a projects model that has many tasks. You can click a checkbox to complete the task and what I am trying to have happen is when that happens change the style of the task and return some additional information. The task updates fine and…
spacerobot
  • 265
  • 1
  • 5
  • 23
0
votes
1 answer

Can Hotwire be implemented on Rails app that already has Angular front end?

I have a RoR app with Angular and I want to make a mobile app of it. I have been searching and it seems Hotwire Turbo might be a good option for a few reasons. In order to use Hotwire in my current project, is it possible to use it with my current…
0
votes
0 answers

Turbo Stream returns correct html, but when mounted to the dom it's hidden?

I'm using rails 7 with tailwind I have a form that I want users to be able to append select inputs to, so I've set up the form to use a turbo stream. It is almost working, but I'm seeing some odd, unexpected behavior. When the turbo stream responds…
Jack Collins
  • 339
  • 1
  • 2
  • 13
0
votes
1 answer

In Rails's new javascript called Stumulus, whas is the point of the hasClass logic?

The logic in the js for this.has[LogicalName]Class is always true, as the class is always defined. For example if you have the html:
And then the js magic…
CafeHey
  • 5,699
  • 19
  • 82
  • 145
0
votes
0 answers

Hotwire Turbo Drive reloads all the page

So I am testing Hotwire in Rails, every thing is working as expected. But if I just generate simple CRUD scaffold for rails and call new action, I can see Turbo drive is using fetch by default and page don't referesh. But when I was reading the…
r3b00t
  • 6,953
  • 6
  • 27
  • 37
0
votes
0 answers

Hotwire Turbo Frame returning all records rather than single created record

I am using Hotwire Turbo Frame to create new record. My understanding was that when we create new record using Turbo Frame then only that single record will be replaced in index page rather than fetching all records from server. But when I look into…
r3b00t
  • 6,953
  • 6
  • 27
  • 37
0
votes
1 answer

rails 7 link_to delete method not working

<%= link_to "Destroy", article_url(article), data: { turbo_method: :delete, turbo_confirm: "Are you sure?"} %> its generated wrong link but after rebooted PC it generate proper link:
roman
  • 11
  • 3
0
votes
0 answers

Trigger stimulus event when target added/removed from DOM

I have what is essentially a form with multiple pages, where there is a partial which renders the form content for each page inside of a partial that contains the header, footer, "next" button. I need my "Next" button to respond dynamically to each…
0
votes
1 answer

Error with Rails Sortable - Cannot read properties of undefined (reading 'dataset')

I followed this tutorial to implement drag and drop. https://www.driftingruby.com/episodes/drag-and-drop-with-hotwire I am getting an error on drop that says Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'dataset').…
spacerobot
  • 265
  • 1
  • 5
  • 23
0
votes
0 answers

How to pass local variables in iteration to turbo_stream?

In my app I have projects which have many tasks. The tasks are iterated through on the projects show page: ### Project#show <% @tasks.each do |task| %>
<%=…
0
votes
1 answer

Rails 7 how to open table inside a row of another table

In my Rails 7 (with bootstrap) app I need to create a table with all users transaction that has on each row an arrow that when clicked on, expands that row inside which is a new table (that's what I think it is - a new table). I think the attached…
mr_muscle
  • 2,536
  • 18
  • 61