いくつかの Active Record 関係の設定に問題があります。
Users
Leagues
UsersたくさんPrimaryLeagues
Users持っている たくさん持っているSecondaryLeagues
プライマリとして設定されている@user.primary_leaguesリストを書き込んで取得できるようにしたいと思います。Leaguesそして、セカンダリとして設定されている@user.secondary_leaguesリストを取得します。Leagues
現在、ここに私のクラスがどのように設定されているかがありますが、どういうわけか間違っています....
class User < ActiveRecord::Base
has_many :primary_leagues, class_name: 'PrimaryLeague', foreign_key: 'league_id'
has_many :secondary_leagues, class_name: 'SecondaryLeague', foreign_key: 'league_id'
...
class PrimaryLeague < ActiveRecord::Base
belongs_to :user
belongs_to :league
...
class League < ActiveRecord::Base
has_many :primary_users, class_name: 'PrimaryLeague', foreign_key: 'user_id'
has_many :secondary_users, class_name: 'SecondaryLeague', foreign_key: 'user_id'
何か案は?