Skip to content

Instantly share code, notes, and snippets.

View fteem's full-sized avatar

Ilija Eftimov fteem

View GitHub Profile
@fteem
fteem / ar-dm
Created December 1, 2011 17:19
activerecord vs datamapper
ActiveRecord Terminology DataMapper Terminology
has_many has n
has_one has 1
belongs_to belongs_to
has_and_belongs_to_many has n, :things, :through => Resource
has_many :association, :through => Model has n, :things, :through => :model
@fteem
fteem / orm.rb
Created December 1, 2011 01:55
My Posts table config
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/blog.db")
class Post
include DataMapper::Resource
property :id, Serial
property :title, String
property :body, Text
property :created_at, DateTime
property :updated_at, DateTime
end