Hi, got an issue here ^^ Ok so my problem is that I have a table named
"users_accounts" and another one named "accounts_messages". As you
will guess, accounts_messages is a list of messages that
"users_accounts" can interchange. Here comes my problem:
for each message I need to know who is the autor and the destinator,
so in "accounts_messages" I have two parameters which are:
autor_user_account_id (refers to the autor account) and
user_account_id (refers to the destinator account).

So in my AccountMessage ruby model class I want to refer two times to
the users_accounts table. How do I do that? More precisely my question
is how do I do to keep the relation navigability for the two
parameters? If I declare those two lines:
class AccountMessage < ActiveRecord::Base
    belongs_to :autor_user_account
    belongs_to :user_account

    ...
end

obviously autor_user_account wont refer alone to the UserAccount
class. So how can I declare those two parameters in order to use them
that way for exemple:

message = AccountMessage.find(...)
printf "autor name: #{message.autor_user_account.name}"
printf "destinator name: #{message.user_account.name}"

We supose here that the "users_accounts" table has a name property of
course.

Hope it's understandable :)
Olivier.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to