Displaying 5 results from an estimated 5 matches for "buddy_id".
2006 Jan 12
0
HABTM with conditional field in relation table
...eRecord::Base
# Hat folgende Buddies
has_and_belongs_to_many :buddies,
:class_name => ''Member'',
:join_table => ''members_have_buddies'',
:association_foreign_key => ''buddy_id'',
:order => ''username''
# Ist Buddy von
has_and_belongs_to_many :buddy_of,
:class_name => ''Member'',
:join_table => ''members_have_buddies'',...
2006 Jan 09
6
has_and_belongs_to_many :self
...:class_name => ''Member'',
:join_table => ''members_have_buddies'',
:foreign_key => ''member_id'',
:association_foreign_key => ''buddy_id''
end
You can see that a member can have any other member as a "buddy"; these
relationships are held in the table members_have_buddies (member_id,
buddy_id).
So far, so good.
I have a member "my_member", that has 3 other members marked as buddies,
so I got 3 entries...
2006 Jul 24
1
Relationship Conventions
...eam!
Just having a bit of trouble with the many-to-many relationship of the
same type.
Im trying to build a buddy list. So I have a users table and want to
allow each user to have a buddlist of users.
Ive tried having a User model and a Buddy model where the buddy model
has 2 fields user_id and a buddy_id but i cant get the buddy.name
methods to resolve when getting a list of buddies.
Anyone know the convention for this type of setup?
Thanks Guys,
Pat
--
Posted via http://www.ruby-forum.com/.
2006 Jan 11
4
Member.buddies.sort >> undefined method `<=>''
Hi all
I have a model Member that has a habtm relationship to buddies (also
members).
Now I wanted to sort them using sort, but this ends in an error
"undefined method <=>"! Where''s the problem here? Sorry, I''m still
beginning to learn Ruby. ;-)
Thanks
Josh
--
Posted via http://www.ruby-forum.com/.
2006 Aug 02
2
Self-Referential has_many :through
Hello all.
I am trying to create a self-referential has_many :through. I used the
following site as a guide
http://blog.hasmanythrough.com/articles/2006/04/21/self-referential-through
but it still doesn''t appear to be working. I have two models. Person and
Relationship. A person has many contacts (Which is another person)
through relationships
class Person < ActiveRecord::Base