0
I가 다음과 같은 모델을 참조 :자체에
class User < ActiveRecord::Base
has_many :groups, :through => :memberships
has_many :memberships, :class_name => "User::Group"
end
class Group < ActiveRecord::Base
has_many :users, :through => :members
has_many :members, :class_name => "User::Group"
end
class User::Group < ActiveRecord::Base
belongs_to :user
belongs_to :group
end
나는 다음과 같은 관계를 호출합니다
@user.groups
을 그리고 대신, User::Group
의 배열을 돌려줍니다. 나는 무엇인가 내려다보고 있냐?