Ruby on Rails

How to redirect from a form that is inside a turbo frame?
This is a very specific question that you will definitely have after working with Hotwire for some time.
There are many possible solutions, some better that the others.
Let's explore the problem and different strategies to solving it:
1. add and click a hidden link
2. new turbo stream redirect action
3. adding turbo stream helpers and params
0:00 Introduction
0:49 Full page redirect does not work?
4:00 Break out of turbo frame does not work?
4:55 turbo stream hidden link
10:50 do not cache hidden link
12:42 Create a New Turbo Stream Action (best redirect)
14:56 A Turbo Stream action with params (more complicated)
19:50 Final demo
Episode source code: github.com/corsego/151-dialog...
Based on this blogpost: blog.corsego.com/custom-turbo...

Пікірлер: 6

  • @kerlq3713
    @kerlq371329 күн бұрын

    12:42 did it for me! Thank you very much

  • @yaroslavbozhak9107
    @yaroslavbozhak91076 ай бұрын

    Thanks 👍

  • @remotronic
    @remotronic6 ай бұрын

    Useful, thanks

  • @njongefred
    @njongefred5 ай бұрын

    Thanks for this

  • @mateuszbialowas
    @mateuszbialowas6 ай бұрын

    Unfortunately in this approach, you are losing the flash message.

  • @SupeRails

    @SupeRails

    6 ай бұрын

    Actually you can! Here's how: flash[:notice] = "Comment created." flash.keep(:notice)