Forum: Ruby on Rails how to send a friend request

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ec66b8181d0cefdb85e32928216cc0ff?d=identicon&s=25 gow (Guest)
on 2007-07-04 06:15
(Received via mailing list)
create table friends
id int not null auto_increment,
user_id int,
friend_id int,
constraint fk_friends_accounts foreign key (user_id) references
foreign key (friend_id) references accounts(id),
primary key(id)

this is my friends tables..friend_id is the field where ids of the
user are filled but before filling that friend_id field,a request is
to be sent to the user who is supposed to be added.

here i request suggestions for how to send that friendrequest...

thanks in advance.
15eb647956921a6bc9655c3513feb139?d=identicon&s=25 lanzm (Guest)
on 2007-07-04 15:31
(Received via mailing list)
you can:

- create but not activate such an entry
- send your request
- activate your entry by receiving the answer from the user
Ec66b8181d0cefdb85e32928216cc0ff?d=identicon&s=25 gow (Guest)
on 2007-07-05 07:19
(Received via mailing list)
thank u lanzem,

can u plz explain in detail how can i send request to other user.

lets leave activation part aside for sometime.

thank u once again..
B1112061b921903a0b337e10048798af?d=identicon&s=25 Chris (Guest)
on 2007-07-05 07:51
(Received via mailing list)
Straight from the Rails wiki:

Ec66b8181d0cefdb85e32928216cc0ff?d=identicon&s=25 gow (Guest)
on 2007-07-05 10:20
(Received via mailing list)
i did see that link..Chris.

i basically want to send a ping messages to user stating that "so n so
send u a friend request" when he logs in.
Will this be possible.I even don't know where to start.any suggestions

thank u for reply..Chris.
15eb647956921a6bc9655c3513feb139?d=identicon&s=25 lanzm (Guest)
on 2007-07-05 11:20
(Received via mailing list)
you can render such "received requests" into a messages-view of your
logged in user. just store the friend_request the sender created as a
FriendRequest instance, set the name of the recipient and mark this
request with a meaningfull state (e.g request_sent)

then if a user is logged in, render its "received requests" area with
something like that

  @received_requests =
FriendRequest.find_by_recipient( session[:user].id )

> > > can u plz explain in detail how can isendrequest to other user.

if I go deeper, I've to write code. So you should get the point.

> > > lets leave activation part aside for sometime.

you can't. the "activation part" is the state of your FriendRequest...
This topic is locked and can not be replied to.