datamapper/dm-session — pull request #2 by solnic (2012-12-16 10:52:39+00:00)
Title: [wip] mapper integration

So. This is probably the simplest thing that can possibly work - we subclass every mapper class and inject session so that we can use IM internally.

This way we can provide the same interface for both session and mapper, for example:

``` ruby
# using mapper
user = env[User].first(:name => 'Piotr')

# using session

env.session do |session|
user = session[User].first(:name => 'John')
session.dirty?(user) # => false
user.name = 'Paul'
session.dirty?(user) # => true

# important part
session[User].get(user.id).object_id == user.object_id # => true
end
```