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

Turbo not loaded when following 7.0.1 tutorial #44229

Closed
Rik-de-Kort opened this issue Jan 21, 2022 · 9 comments
Closed

Turbo not loaded when following 7.0.1 tutorial #44229

Rik-de-Kort opened this issue Jan 21, 2022 · 9 comments

Comments

@Rik-de-Kort
Copy link

Rik-de-Kort commented Jan 21, 2022

Steps to reproduce

Following Getting Started with Rails in the selection on "deleting an article". Clicking the destroy link does nothing, just produce a GET-request for the article itself. Look at the generated HTML, turbo is never loaded. Adding in <%= turbo_include_tags %> in app/views/articles/show.html.erb fixes it.

Expected behavior

Clicking 'Destroy' on the article page removes the article by sending a DELETE-request, with a confim dialog beforehand.

Actual behavior

Turbo is never loaded, so clicking 'Destroy' simply sends a GET-request to the article.

System configuration

Rails version: 7.0.1

Ruby version: ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]

On Arch, I also had some issues with #44143

Is there anything I can do to make sure Turbo is being included without having to remember to type turbo_include_tags all the time?

Also, stylesheets appear not to be loaded either, as my app doesn't correspond to the screenshot in the guide.

@rohandaxini
Copy link
Contributor

rohandaxini commented Jan 22, 2022

Hi @Rik-de-Kort
From the Getting Started with Rails, deleting an article using turbo_method: :delete is working perfectly fine for me. When I look at the generated HTML, turbo is properly loaded for me. I can see that the imports section for me has proper turbo-rails loaded.

"@hotwired/turbo-rails": "/assets/turbo.min-96cbf52c71021ba210235aaeec4720012d2c1df7d2dab3770cfa49eea3bb09da.js",

I am on Rails 7.0.1 and Ruby 3.0.0

I am 🤔 if you are facing this issue > hotwired/turbo-rails#66 that has a fix here hotwired/turbo-rails@c1c0b1d
Ideally, you should not as you are on Rails 7.0.1

I am thinking if your Ruby version 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) is impacting something while generating the import during app bootstrap.

If I find more details then ill add another comment for you soon here.

@Rik-de-Kort
Copy link
Author

Recreating the app from scratch and reinstalling the rails gem seemed to help. However, I'm still getting the rdoc error if I don't add it to my gemfile.
It did prompt me for my password, so maybe there's some global installation thing that went awry?

@mydoomfr
Copy link

I was facing the same issue on a project initialized with the first release of rails 7.0.0. After upgrading to 7.0.1 on the same project, the issue still occurs. The workaround of adding <%= turbo_include_tags %> fix the issue.

Like @Rik-de-Kort, I've ended up recreating a new project from scratch and the issue is now solved.

ruby --version
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin21]

@WeebNetsu
Copy link

I think this issue should be reopened until the workaround/fix is added on the ROR guide, or is at least mentioned...

@skipkayhil
Copy link
Member

I think this issue should be reopened until the workaround/fix is added on the ROR guide, or is at least mentioned

I don't think the <%= turbo_include_tags %> solution should be recommended because it shouldn't be needed at all. Generally, every issue I've seen where people are having issues with Turbo not loading is due to some error while running rails new. If rails new runs without errors, import "@hotwired/turbo-rails" is added to application.js and Turbo will be loaded.

If you (or anyone) can reproduce an error while running rails new, you should absolutely open an issue detailing the steps and the full log of running rails new. Otherwise, I don't think there is anything actionable here.

@vladsf
Copy link

vladsf commented Feb 11, 2023

I have the same issue with Rails 7.0.4.2. Clicking the destroy link does nothing, just produce a GET-request for the article itself.

@vladsf
Copy link

vladsf commented Feb 11, 2023

Also rails new always ends like this

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle config set --local path 'vendor/bundle'
      bundle install

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

@sunwooz
Copy link

sunwooz commented Jul 18, 2023

I'm on Rails 7.0.5 and <%= turbo_include_tags %> finally fixed the problem for me.

@yisuren
Copy link

yisuren commented Nov 5, 2023

same issue with the start up guide, when click destroy link

ruby -v
ruby 3.2.2

rails --version
Rails 7.1.1

<%= turbo_include_tags %> finally fixed the problem

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

9 participants