Skip to content

Instantly share code, notes, and snippets.

@barodeur
Created October 8, 2011 15:02
Show Gist options
  • Save barodeur/1272393 to your computer and use it in GitHub Desktop.
Save barodeur/1272393 to your computer and use it in GitHub Desktop.
simple story model
class Candidate < ActiveRecord::Base
belongs_to :page
belongs_to :story
end
class Page < ActiveRecord::Base
has_many :candidates
belongs_to :story
end
class Story < ActiveRecord::Base
has_many :pages
has_many :candidates, :through => :pages
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment