The problem, if this is the case, is that you lose the benefits of the IM, when working with multiple repositories.
> --
> You received this message because you are subscribed to the Google Groups "DataMapper" group.
> To post to this group, send email to datam...@googlegroups.com.
> To unsubscribe from this group, send email to datamapper+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.
>
use Rails::DataMapper::Middleware::IdentityMap
You won't have an identity-map per-request if you do this though.
On 28/06/2011, at 21:48, Bence wrote:
class ApplicationController < ActionController::Base
use 'Rails::DataMapper::IdentityMaps', :external
use 'Rails::DataMapper::IdentityMaps'
... rest of controller here ...
end
They're not essential, but that's what provides your identity map, so that when you fetch the same resource multiple times, you don't query the database repeatedly, and when that resource is changed, everybody sees the changes.
I have "use Rails::DataMapper::Middleware::IdentityMap" (singular) in my controller... I assume there is a pluralized version for when you're using multiple identity maps. This is just what the dm-rails template configures though.
use Rails::DataMapper::Middleware::IdentityMap, :other
It definitely doesn't work, at least in Rails 3.0.9. You can't pass multiple arguments like that. I'm curious to know how to get this working though.
If I just use the default, I definitely don't have an IM for my :commerce repository... it's easily observed if it's working or not ;)
On 02/07/2011, at 13:46, kristian wrote: