hotwired / turbo-rails

Use Turbo in your Ruby on Rails app
https://turbo.hotwired.dev
MIT License
2.09k stars 322 forks source link

unexpected routes added as part of the turbo rails gem #606

Closed kristoph closed 3 months ago

kristoph commented 6 months ago

I am using rails 7.1.2

Anytime I include the turbo rails gem I see these routes which I do not want to have added:

turbo_recede_historical_location GET /recede_historical_location(.:format) turbo/native/navigation#recede turbo_resume_historical_location GET /resume_historical_location(.:format) turbo/native/navigation#resume turbo_refresh_historical_location GET /refresh_historical_location(.:format) turbo/native/navigation#refresh

How can I remove these routes? Should these really be added as part of the turbo rails gem?

kristoph commented 6 months ago

I see that I can ( presumably ) prevent these routes from being added by setting Turbo.draw_routes to false but I am at a loss to understand where that should be set.

kristoph commented 6 months ago

I was able to solve this by simply creating a turbo.rb initializer and adding Rails.application.config.turbo.draw_routes = false.

But I will leave this issue open because it really seems bad form to have these routes be added by default. The purpose isn't even explained anywhere.

brunoprietog commented 3 months ago

Hi @kristoph, those routes are used by Turbo Native. It's documented here