:Railsの3 - ユーザとhas_manyのユーザーbelongs_toの私は次の操作を行う方法を把握しようとしています
ユーザー(作成者)、has_manyのゲストとhas_manyの主催belongs_toのコンサート。
次のアプローチは良いですか?
コンサート:
class Concert < ActiveRecord::Base
belongs_to :user
has_many :guests, :class_name => 'User'
has_many :organisers, :class_name => 'User'
end
ユーザー:事前に
class User < ActiveRecord::Base
has_many :concerts
end
おかげで、
。あなたは何の問題を抱えていますか? – ipd
ここに素敵なリソース:http://blog.hasmanythrough.com/2007/10/30/self-referential-has-many-through – apneadiving