I'm trying to figure out how to have a two level user relationship.
Photographers have clients. Clients have one photographer. Both are Users.
So I've got a User model that looks like this:
I'm trying to figure out how to have a two level user relationship.
Photographers have clients. Clients have one photographer. Both are Users.
So I've got a User model that looks like this:
Just had to swap the foreign keys
has_many :client_associations, :foreign_key => 'photographer_id', :class_name => 'Association', :dependent => :destroy
has_many :clients, :through => :client_associations
has_one :photographer_association, :foreign_key => 'client_id', :class_name => 'Association', :dependent => :destroy
has_one :photographer, :through => :photographer_association