我正在嘗試創建一個rails應用程序,用戶可以在其中創建事件並邀請其參與者並需要您的幫助! 我一直在圈子裏,嘗試幾件事情,但似乎並不正確,現在這讓我瘋狂! 我正在使用導軌4.Rails has_many:通過關聯
您將如何設置活動模型?
User
has_many :events through :meeting //for the participants?
has_many :events // for the organizer?
Event
belongs to :user
has_many :participants, class_name: "User"
Participant
belongs to :user
has_many :events through :meeting
Meeting
has_many :participants
has_many :events
這是否有意義? 我需要參與者模型嗎?還是我只是過度設計它? 我想我有點困惑組織者是一個用戶和參與者也是用戶和會議需要組織者和參與者,所以不太清楚如何使這項工作...
也讀我可以建立會議關係只有當參與者被添加時。這是否會走? 謝謝!
結賬http://stackoverflow.com/questions/21806860/rails-associations-users-has-many-users-through-comments/21807202#21807202 –