Skip to content

Instantly share code, notes, and snippets.

@nz
Created December 9, 2008 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nz/34106 to your computer and use it in GitHub Desktop.
Save nz/34106 to your computer and use it in GitHub Desktop.
class User < AR::Base
has_many :gathering_participations
has_many :gatherings, :through => :gathering_participations
has_many :gathering_suggestions
has_many :gathering_votes
end
class GatheringParticipation
belongs_to :user
belongs_to :gathering
has_many :gathering_votes
has_many :gathering_suggestions
end
class GatheringSuggestion
belongs_to :user
belongs_to :gathering
belongs_to :gathering_participation
has_many :gathering_votes
end
class GatheringVote
belongs_to :gathering_suggestion
belongs_to :gathering_participation
belongs_to :gathering
belongs_to :user
end
class Gathering
has_many :gathering_participations
has_many :users, :through => :gathering_participations
has_many :gathering_suggestions
has_many :gathering_votes
has_many :voted_suggestions, :through => :gathering_votes # etc
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment