Re: Webpage for game (cups, ladders), uml

innu wrote:

Im already confused of clan part. Clan has one clan_admin and one match_arranger. I should make tabel for each or I just make columns for clan table? Second variant i think.

What is the relation between clan and member? Does each clan have many members? Is one member of each clan considered an admin, and another member a match arranger? Can they both be the same member? Does the admin and match arranger have their own attributes?

innu wrote:

I see mistakes in that diagram, but i just don't know how to fix them.

Can you go into detail on the problems? I'm not familiar with the game so it's hard to say what is wrong and how to improve it.

Re: Webpage for game (cups, ladders), uml

ryanb wrote:

What is the relation between clan and member? Does each clan have many members? Is one member of each clan considered an admin, and another member a match arranger? Can they both be the same member? Does the admin and match arranger have their own attributes?

Members>Member_type>Here is Admin, SubAdmin, Member.

Clan have many members (member_type dosen't count in here).Clan has one clan admin. Clan admin can edit clan settings, arrange matches, invite members(without clan) and promote clan one member to match arranger.Clan match arranger can arrane_matches.It's not necessary that clan has match arranger.

Clan admin and match_arranger dosen't have their own attributes.

I got some ideas, when posting this post . Already helped a bit.I'll try to develop a bit. Then I'll probably can ask a bit better questions.

An alternative (and probably better) approach is to use Single Table Inheritance. By adding a type column to the members table, you can subclass Member with Admin and MatchAssigner. You can then easily give each class its own behavior and permissions. This will only work well if a given member cannot be both Admin and MatchAssigner and cannot belong to multiple clans.

Re: Webpage for game (cups, ladders), uml

class LadderController < ApplicationController

before_filter :login_required, :except => [:show, :list]

## Join / leave method: only clan_admins clan use it. ## how should i make filter. Just add check methods to application? and use somthing like this: ## before_filter :clan_admin_required, :only => [:join, :leave]

has_many :admins, :through => :ladder_admins << dont work because there is no admin_id field. right? With has_many :members it works. If I try to use class_name, foreign_key options, I just get:ActiveRecord::HasManyThroughSourceAssociationNotFoundError: ActiveRecord::HasManyThroughSourceAssociationNotFoundError

Re: Webpage for game (cups, ladders), uml

innu wrote:

has_many :admins, :through => :ladder_admins << dont work because there is no admin_id field. right? With has_many :members it works. If I try to use class_name, foreign_key options, I just get:ActiveRecord::HasManyThroughSourceAssociationNotFoundError: ActiveRecord::HasManyThroughSourceAssociationNotFoundError