Self-referential has_many :through with customized :primary key issue?

I believe it should be like this: class Connection 'User' belongs_to :follower, :class_name => 'User' end class User 'follower_id', :class_name => 'Connection' has_many :relations_from, :foreign_key => 'subject_id', :class_name => 'Connection' has_many :linked_from, :through => :relations_from, :source => :follow has_many :linked_to, :through => :relations_to, :source => :subject end while I removed a few things, it looks like your :source => :follow and :source => :subject were switched and it created a circular reference.

It works. Awesome! I never knew there's a method called set_primary_key.

Thank you! – porkeypop Jun 25 '10 at 16:28.

The reason I have to use :user_id instead of the standard id is because my primary key has to be a string. What can I do to make the relation work, so that I can do User.first. Linked_from and User.first.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions