このためのデータベース設計を理解しようと懸命に努力していますが、完全には理解できません。
AUserは many に属し、それぞれNetworksに 1 つRoleずつありNetworkます。複数のユーザーが(管理者、編集者、閲覧者など) にUsers同じものを持っている場合がありRoleます。Network主なデータはEvent. は、内の自分に基づいてUser作成/表示/編集/破棄できます。EventsRoleNetwork
ユーザーはスルースルー経由でイベントにアクセスできますか?
class User < ActiveRecord::Base
has_many :roles
has_many :networks, :through => :roles
has_many :events, :through => :networks
end
class Role < ActiveRecord::Base
belongs_to :network
has_many :users
end
class Networks < ActiveRecord::Base
has_many :roles
has_many :users, :through => :roles
has_many :events
end
class Events < ActiveRecord::Base
belongs_to :network
has_many :roles, :through => :network
has_many :users, :through => :roles
end
私が探しているものから離れているのか、それとも本当に近いのかはわかりません。どんな助けでも大歓迎です。