search for: user2_id

Displaying 1 result from an estimated 1 matches for "user2_id".

Did you mean: user2_ip
2008 Sep 12
1
Referencing exactly two models of the same kind
...e this: class User ActiveRecord::Base # Given a User, I do not require to be able to retrieve all his messages. end class Message < ActiveRecord::Base belongs_to :user; # Sender belongs_to :user2; # Receiver end The DB Tables should look something like this: users id messages id, user_id, user2_id; How do the Rails models and the database tables look like? I''m generally wondering how to reference more than one model of the same kind from within another model, without using many_to_many or one_to_many relationships. Fritz --~--~---------~--~----~------------~-------~--~----~ You re...