Im trying to get my head around a model association issue that I’ve been
struggling with despite the fact that I know I’ve done the exact same
I have the following models:
class User < ActiveRecord::Base
class UserMailbox < ActiveRecord::Base
This all works fine and user maps to usermailbox through user_id.
The problem Im having is that the usermailbox table also has a
“other_user_id” field which also links back to the users table. I cannot
for the life of me figure out how I set this up in the model so that i
would be able to call something along the lines of:
for item in @user.user_mailboxes
So in essence my issue is that I have two fields in one table pointing
back at the same table and need to setup associations.
Any help would be greatly appreciated.