Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## article.rb
- class Article
- include DataMapper::Resource
- property :id, Integer, :serial => true
- property :url, String, :nullable => false, :length => 255, :format => /http:\/\//
- property :body, Text
- has n, :matches
- has n, :keywords, :through => :matches
- end
- ## keyword.rb
- class Keyword
- include DataMapper::Resource
- property :id, Integer, :serial => true
- property :keyword, String, :nullable => false
- has n, :matches
- has n, :articles, :through => :matches
- end
- ## matches.rb
- class Match
- include DataMapper::Resource
- property :id, Integer, :serial => true
- belongs_to :article
- belongs_to :keyword
- property :weight, Integer
- end
Add Comment
Please, Sign In to add comment