Displaying 3 results from an estimated 3 matches for "acquaintance_id".
2006 Feb 25
0
self referential habtm using join tables
...Here is what I have that works a
little, but not really:
Migrations:
create_table "users" do |t|
t.column "name", :string
t.column "email", :string
end
create_table "friends" do |t|
t.column "user_id", :integer
t.column "acquaintance_id", :integer
t.column "approved", :integer
end
Models:
class Friend < ActiveRecord::Base
belongs_to :users
belongs_to :friends
end
class User < ActiveRecord::Base
has_many :friends
has_many :acquaintances, :through => :friends,
:class_name => "User...
2006 Feb 27
0
self-referential many-to-many using a join model
...luck. Here is what I have that works a
little, but not really:
Migrations:
create_table "users" do |t|
t.column "name", :string
t.column "email", :string
end
create_table "friends" do |t|
t.column "user_id", :integer
t.column "acquaintance_id", :integer
t.column "approved", :integer
end
Models:
class Friend < ActiveRecord::Base
belongs_to :users
belongs_to :friends
end
class User < ActiveRecord::Base
has_many :friends
has_many :acquaintances, :through => :friends,
:class_name => "User"...
2006 Feb 21
7
Self-referencial habtm relationship
Heyo!
I am setting up a self-referencial habtm relationship with the users
of my app. I am using Chad Fowler''s "Rails Recipes" to get me started,
and everything works great with the join table "people_friends". I add
friends by doing somebody.friends << somebodyelse. However, with my
app, there is an approval process so my join table has columns
person_id,