Give Each User A Friends List With Rails Associations - Ruby On Rails Friend List App #8

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ม.ค. 2025
  • In this video I'll show you how to create friend lists for each logged in user by using Rails Associations.
    Rails Associations allow us to associate different tables of our database together. It allows us to say, hey...this friend belongs to this user; and this user has many friends.
    Database Table Associations with Rails are really easy to do, and you'll learn how to do them in this video!

ความคิดเห็น •

  • @Codemycom
    @Codemycom  4 ปีที่แล้ว +1

    ▶️ Watch Entire Ruby on Rails Playlist ✅ Subscribe To My TH-cam Channel:
    bit.ly/3hvlr7P bit.ly/2IGzvOR
    ▶️ See More At: ✅ Join My Facebook Group:
    Codemy.com bit.ly/2GFmOBz
    ▶️ Learn to Code at Codemy.com ✅ Buy a Codemy T-Shirt!
    Take $30 off with coupon code: youtube1 bit.ly/2VC9WUN
    ▶️ Get The Code
    bit.ly/3iLOq97

    • @MrSuperNova46
      @MrSuperNova46 2 ปีที่แล้ว

      what if someone inspects the page changes the id value, and submits, does it add a friend to another user?

  • @CharlesDv
    @CharlesDv 3 ปีที่แล้ว +12

    You should assign the current user id inside the controller or model instead of as a hidden input. Thanks.

    • @chokopepites6295
      @chokopepites6295 3 หลายเดือนก่อน

      yeah, you' re right, in the method create :
      "
      @friend = Friend.new(friend_params)
      @friend.user_id = current_user.id "
      Cleanest and more secure

  • @robertmasters01
    @robertmasters01 ปีที่แล้ว

    would you be able to show how a sorting feature would work with ruby on rails, with say sort by first name in alphabetical order?

  • @ericyoung4542
    @ericyoung4542 2 ปีที่แล้ว

    Fantastic tutorial!

  • @skyleonidas9270
    @skyleonidas9270 4 ปีที่แล้ว

    Very Nice

  • @rociomartinez1917
    @rociomartinez1917 4 ปีที่แล้ว

    Thank you

    • @Codemycom
      @Codemycom  4 ปีที่แล้ว

      You're welcome!