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

Create instance of a model remotely

I have a turns model that i want to create based off a card id and a user id, the user id is passed correctly, but the card id is nil. This is the card turbo frame <%= turbo_frame_tag "play_card_frame" do %> <%= render "turns/form", turn:…
0
votes
1 answer

Rails7+Devise+Captcha: undefined method `users_url' for #

Prereq: Rails 7.0.4 Devise 4.9.0 with hotwire/turbo support Responders 3.1.0 Devise has the default config with config.responder.error_status = :unprocessable_entity config.responder.redirect_status = :see_other lines in it. It works properly…
noff
  • 115
  • 1
  • 5
0
votes
1 answer

Using Hotwire to full page reload based on value from selectbox

I've searched through the hotwire docs and I know that I can pass target value to "_top" to make full page reload. But I need some elegant way to do this. Let's say i have on the every page selectbox where user can pick account under which he will…
0
votes
1 answer

Hotwire turbo with turbo-method: :delete and redirect_to

My test erb: <%= link_to 'Test', test_path, data: { turbo_method: :delete } %> My test controller method looks like this: def test redirect_to root_path, status: :see_other end Simple as that.. it responds with a turbostream and appends the…
Oliver
  • 801
  • 13
  • 26
0
votes
1 answer

How to edit a single attribute inline with Turbo Frame and Trubo Stream with validation feedback?

Creating In-Place-Editing of a single attribute of a model using Turbo Frames (not using a gem such as Best_In_Place as it requires jQuery and is not working well with Rails 7) This implemenation is using ONLY turboframes. To accomplish this I…
0
votes
1 answer

How do I change text label on svg click using javascript in Rails 7 app?

Users can click a checkmark icon to mark a park as Visited (grey checkmark) or Not Visited (green checkmark). I want to also make the text next to the checkmark icon change every time the user clicks the checkmark (between "Visited" and "Not…
Rebecca
  • 88
  • 1
  • 9
0
votes
1 answer

Unable to run after_action callback for turbo_stream actions

So I have a 'ThaaliTakhmeens' controller where some actions have their corresponding turbo_stream templates to lazy load instances from databases using hotwire with pagination (pagy). And in those actions, there's a similar logic that I want to…
0
votes
0 answers

Rails 7 turbo_frame_tag

I have two forms on the same page. The first one: <%= form_with url: admin_users_path, method: :get, class: "d-none d-md-inline-block me-auto w-100", data: { autosave_delay_value: 300, …
plewas
  • 229
  • 1
  • 3
  • 11
0
votes
1 answer

How can I make use of turbo frames correctly?

I have the next "controllers/pages_controller.rb": class PagesController < ApplicationController def home end def stack end def about end end I have the next "routes": Rails.application.routes.draw do root "pages#home" get 'home',…
0
votes
0 answers

Rails Hotwire - How to search within existing form

I have form that has a section that displays a series of checkboxes for what groups a user manages. I want to add a search box at the top of the checkboxes that allows them to search a name and have it filter the results. From there they can check…
spacerobot
  • 265
  • 1
  • 5
  • 23
0
votes
0 answers

Trigger turbo_stream and html response within show action rails 7

I have a simple messaging app. Users can set up a public profile with their description and people can send them inquiries. Those inquiries are then collected in a table in the user dashboard. When a user is clicking on a row, a turbo frame opens up…
0
votes
0 answers

How to render a custom action results from controller in views using Rails 7 without refreshing the page?

I have this a custom action in Task controller, which has if else statements and returns Api calls from Safe browsing api, which I need to render to users in index.html.erb without refreshing the page. I've tried Ajax but it doesn't seem to work…
0
votes
1 answer

Turbo Stream Rails does not update page

I am new to Ruby on Rails and need help with figuring out how Turbo Stream works in Rails. I did everything by tutorials, however, the content of the page was not updating. I decided to test how Turbo Stream will behave on simple div. In…
Liuba
  • 33
  • 8
0
votes
1 answer

How can I improve this dynamic partial load

I am dynamically loading partials based on the occurrence drop down that is select like this: