CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Sat, 30 Aug 2025 08:02:52 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20090131034114
location: https://web.archive.org/web/20090131034114/https://github.com/datamapper/dm-core/tree
server-timing: captures_list;dur=0.480821, exclusion.robots;dur=0.018049, exclusion.robots.policy;dur=0.009883, esindex;dur=0.010408, cdx.remote;dur=25.496311, LoadShardBlock;dur=184.454846, PetaboxLoader3.datanode;dur=73.609262, PetaboxLoader3.resolve;dur=37.241773
x-app-server: wwwb-app204
x-ts: 302
x-tr: 232
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app204; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 301
server: nginx
date: Sat, 30 Aug 2025 08:02:52 GMT
content-type: text/html; charset=utf-8
content-length: 114
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Sat, 31 Jan 2009 03:41:13 GMT
x-archive-orig-connection: close
x-archive-orig-status: 301 Moved Permanently
location: https://web.archive.org/web/20090131034114/https://github.com/datamapper/dm-core/tree/master
x-archive-orig-x-runtime: 69ms
x-archive-orig-cache-control: no-cache
x-archive-orig-content-length: 114
cache-control: max-age=1800
memento-datetime: Sat, 31 Jan 2009 03:41:14 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 31 Jan 2009 03:41:14 GMT", ; rel="memento"; datetime="Sat, 31 Jan 2009 03:41:14 GMT", ; rel="next memento"; datetime="Sat, 14 Feb 2009 01:16:26 GMT", ; rel="last memento"; datetime="Sun, 01 Aug 2010 06:44:00 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_7_20090130143853_crawl100-c/52_7_20090131034012_crawl101.arc.gz
server-timing: captures_list;dur=0.598787, exclusion.robots;dur=0.019951, exclusion.robots.policy;dur=0.008903, esindex;dur=0.011132, cdx.remote;dur=4.031485, LoadShardBlock;dur=149.722700, PetaboxLoader3.datanode;dur=112.878634, PetaboxLoader3.resolve;dur=121.534560, load_resource;dur=192.410695
x-app-server: wwwb-app204
x-ts: 301
x-tr: 371
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sat, 30 Aug 2025 08:02:53 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.26
x-archive-orig-date: Sat, 31 Jan 2009 03:41:13 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 353ms
x-archive-orig-etag: "c00c28fdff3beae5255b14b7a30e62b0"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 30981
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 31 Jan 2009 03:41:14 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Sat, 31 Jan 2009 03:41:14 GMT", ; rel="memento"; datetime="Sat, 31 Jan 2009 03:41:14 GMT", ; rel="next memento"; datetime="Thu, 12 Feb 2009 16:09:18 GMT", ; rel="last memento"; datetime="Fri, 19 Jul 2013 04:34:35 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_7_20090130143853_crawl100-c/52_7_20090131034012_crawl101.arc.gz
server-timing: captures_list;dur=0.491236, exclusion.robots;dur=0.018972, exclusion.robots.policy;dur=0.009671, esindex;dur=0.009757, cdx.remote;dur=3.905295, LoadShardBlock;dur=100.752821, PetaboxLoader3.datanode;dur=82.133510, PetaboxLoader3.resolve;dur=121.976994, load_resource;dur=108.992045
x-app-server: wwwb-app204
x-ts: 200
x-tr: 300
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
datamapper's dm-core at master - GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (

This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (

Description: | DataMapper - Core |
Homepage: | https://datamapper.org/ |
Clone URL: |
git://github.com/datamapper/dm-core.git
Give this clone URL to anyone.
git clone git://github.com/datamapper/dm-core.git
|
dm-core /
:include:QUICKLINKS = Why DataMapper? == Open Development DataMapper sports a very accessible code-base and a welcoming community. Outside contributions and feedback are welcome and encouraged, especially constructive criticism. Make your voice heard! Submit a ticket[https://wm.lighthouseapp.com/projects/4819-datamapper/overview] or patch[https://wm.lighthouseapp.com/projects/4819-datamapper/overview], speak up on our mailing-list[https://groups.google.com/group/datamapper/], chat with us on irc[irc://irc.freenode.net/#datamapper], write a spec, get it reviewed, ask for commit rights. It's as easy as that to become a contributor. == Identity Map One row in the data-store should equal one object reference. Pretty simple idea. Pretty profound impact. If you run the following code in ActiveRecord you'll see all <tt>false</tt> results. Do the same in DataMapper and it's <tt>true</tt> all the way down. @parent = Tree.find(:first, :conditions => ['name = ?', 'bob']) @parent.children.each do |child| puts @parent.object_id == child.parent.object_id end This makes DataMapper faster and allocate less resources to get things done. == Dirty Tracking When you save a model back to your data-store, DataMapper will only write the fields that actually changed. So it plays well with others. You can use it in an Integration data-store without worrying that your application will be a bad actor causing trouble for all of your other processes. You can also configure which strategy you'd like to use to track dirtiness. == Eager Loading Ready for something amazing? The following example executes only two queries. zoos = Zoo.all first = zoos.first first.exhibits # Loads the exhibits for all the Zoo objects in the zoos variable. Pretty impressive huh? The idea is that you aren't going to load a set of objects and use only an association in just one of them. This should hold up pretty well against a 99% rule. When you don't want it to work like this, just load the item you want in it's own set. So the DataMapper thinks ahead. We like to call it "performant by default". This feature single-handedly wipes out the "N+1 Query Problem". No need to specify an <tt>include</tt> option in your finders. == Laziness Can Be A Virtue Text fields are expensive in data-stores. They're generally stored in a different place than the rest of your data. So instead of a fast sequential read from your hard-drive, your data-store server has to hop around all over the place to get what it needs. Since ActiveRecord returns everything by default, adding a text field to a table slows everything down drastically, across the board. Not so with the DataMapper. Text fields are treated like in-row associations by default, meaning they only load when you need them. If you want more control you can enable or disable this feature for any field (not just text-fields) by passing a @lazy@ option to your field mapping with a value of <tt>true</tt> or <tt>false</tt>. class Animal include DataMapper::Resource property :name, String property :notes, Text, :lazy => false end Plus, lazy-loading of text fields happens automatically and intelligently when working with associations. The following only issues 2 queries to load up all of the notes fields on each animal: animals = Animal.all animals.each do |pet| pet.notes end == Plays Well With Others In ActiveRecord, all your fields are mapped, whether you want them or not. This slows things down. In the DataMapper you define your mappings in your model. So instead of an _ALTER TABLE ADD field_ in your data-store, you simply add a <tt>property :name, :string</tt> to your model. DRY. No schema.rb. No migration files to conflict or die without reverting changes. Your model drives the data-store, not the other way around. Unless of course you want to map to a legacy data-store. Raise your hand if you like seeing a method called <tt>col2Name</tt> on your model just because that's what it's called in an old data-store you can't afford to change right now? In DataMapper you control the mappings: class Fruit include DataMapper::Resource storage_names[:repo] = 'frt' property :name, String, :field => 'col2Name' end == All Ruby, All The Time It's great that ActiveRecord allows you to write SQL when you need to, but should we have to so often? DataMapper supports issuing your own query, but it also provides more helpers and a unique hash-based condition syntax to cover more of the use-cases where issuing your own SQL would have been the only way to go. For example, any finder option that's non-standard is considered a condition. So you can write <tt>Zoo.all(:name => 'Dallas')</tt> and DataMapper will look for zoos with the name of 'Dallas'. It's just a little thing, but it's so much nicer than writing <tt>Zoo.find(:all, :conditions => ['name = ?', 'Dallas'])</tt>. What if you need other comparisons though? Try these: Zoo.first(:name => 'Galveston') # 'gt' means greater-than. We also do 'lt'. Person.all(:age.gt => 30) # 'gte' means greather-than-or-equal-to. We also do 'lte'. Person.all(:age.gte => 30) Person.all(:name.not => 'bob') # If the value of a pair is an Array, we do an IN-clause for you. Person.all(:name.like => 'S%', :id => [1, 2, 3, 4, 5]) # An alias for Zoo.find(11) Zoo[11] # Does a NOT IN () clause for you. Person.all(:name.not => ['bob','rick','steve']) See? Fewer SQL fragments dirtying your Ruby code. And that's just a few of the nice syntax tweaks DataMapper delivers out of the box...
This feature is coming soon. Sit tight!