On 11 Dec 2007, at 09:24, Veera Sundaravel wrote:
> > HI everybody, > > I need some help with model association. > Hi, this isn't the list for this type of question. Head on over to rubyonrails-talk Fred > Here I have one user table. > > User table. > id name > 1 XXX > 2 YYY > 3 ZZZ > 4 XYZ > > Message Table > > id sender_id receiver_id message > 1 1 2 HI. HOW R U > 2 2 1 YEAH. FINE > 3 2 4 HI. WR R U NOW? > > > 1. Here I want get the sender_name and receiver name for an message. > Like below > @msg=Message.find(1) > @msg.sender.name > @msg.receiver.name > > 2. Same like I want to get the sent and received messages for a > Particular message. > @user=User.find(1) > @user.sent_msg > @user.received_msg > > Can any one help how I have to build the association between these two > models, Here I dont want to create one more table. > > Regards, > T.Veeraa. > -- > Posted via http://www.ruby-forum.com/. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
