```ruby
class ApplicationController < ActionController::Base
  protect_from_forgery
  layout 'application'
end
```

Use Identity Map middleware in ApplicationController
user
```ruby
require 'dm-rails/middleware/identity_map'

class ApplicationController < ActionController::Base
  use Rails::DataMapper::Middleware::IdentityMap
  protect_from_forgery
  layout 'application'
end
```
assistant