Ruby on Rails #80 Dynamic Forms with Turbo (not JS approach)

Поделиться
HTML-код
  • Опубликовано: 24 ноя 2024

Комментарии • 30

  • @andreasandres
    @andreasandres 2 года назад +8

    bro, i think you're a modern version from ryan bates or even better.. love your tutorial, i learned much from here..

    • @SupeRails
      @SupeRails  2 года назад +1

      Hello Andre! Thanks a lot! I’m trying my best 🤠

  • @DanielHernandoGilRomero
    @DanielHernandoGilRomero 13 дней назад

    Thanks for the guide! Good job.

  • @ledockol
    @ledockol 2 года назад +3

    Дуже цікаво. Деякі речі, наприклад вбудований турбо стрим, це взагалі щось нове! Дуже за це дякую)
    Разом з тим, якщо вже використовуємо стімулус, то додаткова кнопка форми зайва. Додати ще одно value і сформувати запит безпосередньо у стімулус контролері, у заголовок додати очікувану відповідь у турбо стрим форматі. Одночасно цим же контролером можно контролювати зміст парамс, щоб не виводити зайвого у строчці браузера.
    Ярослав, ще раз дякую! Подивився як чашку гарної кави випив)
    Слава Україні!

    • @SupeRails
      @SupeRails  2 года назад +1

      Вітаю! Чи міг би ти показати що ти маєш на увазі у форматі gist? :)

    • @ledockol
      @ledockol 2 года назад

      @@SupeRails Звісно.

  • @cmthimmaiah
    @cmthimmaiah Год назад +1

    Thank you,very clearly explained

  • @diegogarciaspino6048
    @diegogarciaspino6048 2 года назад +1

    very clear, strong base, loved

  • @danielfonsecadasilva396
    @danielfonsecadasilva396 2 года назад +1

    I love you! thanks

  • @MarkWeiser
    @MarkWeiser 2 года назад +2

    Great tutorial, but I hit 2 issues:
    1. simple_form does not let me create a button with get action on form (might have to bypass simple_form)
    2. i got around the first problem by creating a submit button with a different commit parameter, and catch the submission in the create controller method: " if params[:commit].eql? 'validate'
    return render :new
    end"
    however the submit will not be invoked if html 5 is validating required fields
    Any ideas?

  • @mariners_platter
    @mariners_platter 2 года назад +2

    I enjoy your content! Thanks so much!

  • @1990EAM
    @1990EAM Год назад

    How do you show validation errors using turbo?

  • @hass89
    @hass89 2 года назад +1

    How can this be used with nested form fields (accepts_nested_attributes_for)?

    • @SupeRails
      @SupeRails  2 года назад +1

      if you want to "add/remove" nested fields, you would need something else. like gem vanilla_nested, or some other solution

  • @clementblgr6498
    @clementblgr6498 2 года назад +1

    Dont forget to enter this command after creating a stimulus controller :
    ./bin/rails stimulus:manifest:update

  • @ddd2283
    @ddd2283 2 года назад +1

    Hi Yaroslav! Can you explain turbo + action_cabe integration in some video. Thanks!

    • @SupeRails
      @SupeRails  2 года назад

      I wish I could 😂
      I'll put it on the backlog +

    • @ddd2283
      @ddd2283 2 года назад +1

      @@SupeRails I saw it in book "modern frontend for ruby on rails" but your english more undestanable for me )))). In this book author show some intresting thing as "stimulate". I think you can explain better )))

    • @ddd2283
      @ddd2283 2 года назад +1

      I was wrong about naming this technology , I mean StimulusReflex , this example official ruclips.net/video/dPzv2qsj5L8/видео.html

    • @ddd2283
      @ddd2283 2 года назад

      Anyway , still waiting your awesome explanation😀

    • @SupeRails
      @SupeRails  2 года назад

      @@ddd2283 oh, got it! I'm aware of stimulus reflex, and I know that it can do similar things as hotwire/turbo. However I don't have enough practical experience with it to be able to cover it in a good video at the moment. SR sure is on my TODO list for when I know it well enough :)

  • @germancruz6484
    @germancruz6484 2 года назад

    what's the shortcut to back to the terminal

    • @SupeRails
      @SupeRails  2 года назад

      alt+tab? did I understand your question correctly? 😄

  • @baotranphi1238
    @baotranphi1238 2 года назад

    Can u make a video about active storage and presigned url s3 upload?

  • @pftg
    @pftg Год назад

    It's more like an hack! You can avoid hidden button click at all.

    • @SupeRails
      @SupeRails  Год назад

      Hey Paul! I wouldn't call it a hack. It's quite a reliable approach, leveraging only normal http requests and Hotwire

  • @MatthewKennedyUK
    @MatthewKennedyUK 2 года назад +1

    How do you deal with the edit side and persisting the params? Maybe use @post.assign_attributes(post_params)

    • @SupeRails
      @SupeRails  2 года назад

      interesting question. in this scenario where “new” and “edit” share the same form, I suppose it’s still ok to submit the “form.button” to “new_post_path”. If I create a record and open the edit form, everything seems to be working ok

    • @SupeRails
      @SupeRails  2 года назад

      Ok, I see an issue: when you go to "edit" and refresh the page, the selection can look "broken". I will show my solution in episode #82

    • @SupeRails
      @SupeRails  2 года назад +1

      Ok now I really understand where you were going. assign_attirbutes seems to be a good solution. I've used it today for a PR at work where I had to partially update an "Edit" form and worked very well