Get two associations within a Factory to share another association
问题 I've got these 5 models: Guardian, Student, Relationship, RelationshipType and School. Between them, I've got these associations class Guardian < ActiveRecord::Base belongs_to :school has_many :relationships, :dependent => :destroy has_many :students, :through => :relationships end class Student < ActiveRecord::Base belongs_to :school has_many :relationships, :dependent => :destroy has_many :guardians, :through => :relationships end class Relationship < ActiveRecord::Base belongs_to :student