Hi, I’m trying to create a little system where users can add each other
as “friends”. To do this, I’m imagining one user going to the profile
of another user and clicking a link that says “Add this person as a
friend”. When the link is clicked, I’d like the username of both of the
users to be entered into a database table called “friends”.
I just don’t know where to start with this (except that I set up the
table). The session data for the current user is aptly called
“current_user”, so somehow that data, plus the username of the profile
being viewed needs to be added as a row in the friends table.
I’m really new to this, but I know that I probably need to create a
controller for friends, and set up an action like “Add”. I just don’t
know how to insert those two usernames into the table properly.
Any resources on this topic? Thanks in advance.