Skip to content

Instantly share code, notes, and snippets.

@pikajude
Created November 29, 2010 00:02
Show Gist options
  • Save pikajude/719416 to your computer and use it in GitHub Desktop.
Save pikajude/719416 to your computer and use it in GitHub Desktop.
DataMapper.setup(:default, "sqlite3:users.db")
class Post
include DataMapper::Resource
has n, :voters
property :id, Serial
property :user, String, :required => true
property :line, Text, :required => true
property :created_at, DateTime
property :votes, Integer, :default => 0
property :score, Integer, :default => 0
property :ip, String
end
class Voter
include DataMapper::Resource
belongs_to :post
property :id, Serial
property :ip, String
property :positive, Boolean
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment