Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey all. I was playing around with hotwire and it's awesome. I was trying to see if it can replace my current setup. Basically it's using this gem - https://github.com/jorgemanrubia/turbolinks_render, which is really awesome. When you submit a form it just replaces the whole content with new content. Form validations are non issue this way, redirects are working too etc.
Hotwire almost replaces this gem, however there is a slight problem. Forms must redirect or use turbo frames. I don't really understand why forms must redirect, but I am sure there is a reason for it so I would be interested to hear it.
Since I don't understand why they have to redirect I think it's unnecessary, so this is a POC of how I think it should work. You submit a form without any frames - it replaces the whole content. Behind the scenes it does simulated turbo visit with either redirected location or the current location.
This way, even when you use something like devise for authentication, you can make the devise form to be ajax based very easily - no need to edit the views & controllers to add turbo frames to it. The same goes for any form really. No need to add turbo frames, by default it just replaces the whole body. However you can still return something like
and it still works, only the
#form
is replaced.Please let me know if you would be interested to continue with this - I will then look into tests. If not, feel free to just close it. ✌️