Skip to content

Instantly share code, notes, and snippets.

@gobijan
Created March 19, 2012 10:27
Show Gist options
  • Save gobijan/2106782 to your computer and use it in GitHub Desktop.
Save gobijan/2106782 to your computer and use it in GitHub Desktop.
Referencing the same Model type under another name...
Post
has_many :upvotes <= Model: Vote
has_many :downvotes <= Model: Vote
Vote
Fields: user_id, comment
belongs_to :post <= as an upvote or downvote..
What I want to achieve:
Post.upvotes.first().comment
and stuff like this...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment