Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When POSTing forms: undefined method `turbo_stream_action_tag' for Turbo::StreamsHelper:Module #5

Open
randomsnowflake opened this issue Dec 14, 2023 · 3 comments

Comments

@randomsnowflake
Copy link

randomsnowflake commented Dec 14, 2023

I want to show a form as a modal, and also as a normal page.

This simple code fails during runtime with the exception from the title:

<%= modal(advance: false, title:) do %>

It fails in lib/ultimate_turbo_modal/base.rb:55 (see attached stacktrace)

The modal code works in my form, when it is ...

  • executed as a "popup" modal
  • loaded through normal page navigation

It does not work, when ...

  • the form is reloaded after an invalid form submission (using Turbo)
  • the form is reloaded after a POST request to the server

I'm using the newest version of Rails & Co. Turbo works fine in my app.

See my Gemfile.lock

Also: stacktrace.txt

@randomsnowflake
Copy link
Author

In case anybody else needs the fix:

# application_helper.rb

	def mymodal(**options, &block)
		begin
			modal(**options, &block)
		rescue => e
			capture(&block)
		end
	end

@muriloime
Copy link

@cmer First of all , nice solution , I am still studying it to try to make it more general, I was looking for such a solution for a long time.

Secondly, Is the proposed solution a good one? If so , why not to put it into the gem ?

I am also receiving this error, and can help with a PR

@cmer
Copy link
Owner

cmer commented Sep 18, 2024

Let me investigate this further I never saw this before.

@cmer cmer reopened this Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants