This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder