Ruby on Rails Forms With Hotwire

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

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

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

    Awesome video, keep the good work!

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

    Yes this is what the rails community needs a revival esp. with what turbo-streams has to offer. Would you be willing to put any of this video related code on public repo?

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

      I might, I'm not sure yet.

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

    Very nice! This is what Im looking for. A form and list example using hotwire. Thank you!

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

      You're very welcome!

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

      @@mixandgo When the form is on edit, the field values are not blanked or reset to fields placeholders (i.e. "Your firs name" etc) after clicking Save. How to do it? Thanks again.

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

      @@edmundo5450 yes, that is intentional, since you're still editing (if you look at the URL, you see the ID of the record you're editing). Reset doesn't make sense (to me), but to do it you'd need to clear the form in the `update.turbo_stream.erb` template just like I did in the `create` template (i.e. render the form with a Contact.new as the contact local variable).
      I think it makes more sense to redirect to a different page, like /contacts/new in order to display an empty form.
      Hopefully, that makes sense.

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

      @@mixandgo It works!! Thanks a lot.

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

      You're welcome :)

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

    Nice video. Could you please show your routes.rb? Are you using put or patch to update or just post? Thank you.

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

      You can check out the repository (in the description).

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

    Great video - thanks :) What do I need to 'play' with hotwire? Does it really require sidekiq and redis on production?

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

      Are you planning on using ActionCable? If so you're going to need Redis. But you can use hotwire without ActionCable, if you don't need to broadcast updates.

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

    Thanks for posting these! I've been watching all your videos. I have a suggestion. One is creating a group, like a facebook groups, where people can join and comment and get notifications, also be able to make that group public, private, or secret. And also be able to make another user like a group admin. The other suggestion is upgrading to Rails 7 and removing webpacker.

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

      Thanks for your suggestion Nelson. Would that group be different from RUclips (where you can comment and get notifications)? What would be the utility of the group?

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

      @@mixandgo oh I'm not familiar with youtube groups. The utility of the group is to share information and ask questions to help each other out. for example i am in a Toyota 4runner group in facebook. where people can comment, share photos, or ask questions on how to fix their car and people can comment on your post. The admin can kick people out or make other people admin as well so people don't post selling ads. and the group is private. you can ask to join and the admin will let you in. sometimes you just answer some questions and they let you automatically. I'm guessing the groups can have 3 different choices like public, private, or secret

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

      @@nelsonchavespro I would join :)

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

      @@nelsonchavespro oh I was just referring to the regular comments section and notifications that RUclips provides (sorry if that was confusing). I see what you mean now, I do plan to create such a group for the members of the Rails course I'm building, but I haven't thought about a public one.

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

    After cloning the repo and running bundle I got an error.
    The asset "application.css" is not present in the asset pipeline.
    Any ideas what I can do?

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

      Have you tried running yarn? and then ./bin/dev

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

      @@mixandgo That worked for me thank you Cesar!

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

      @@davidcordero9864 happy to hear that

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

    Apart from all the turbo stuff, I really like the inline_error_for helper. Neat!

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

      Thanks Jens, glad you liked that.