with the help of the repository scope like DataMapper.repository(:default) do # something end
I can create all kind of unexpected results. I prepared some example to illustrate this. the first two examples share the same repository throughout and for me this is what I expect when I read the code. using the same repository means also to use the identity-map thus having only one instance of the Counter model http://pastie.org/312214 http://pastie.org/312215 the next example uses a new repository instance for each create/get call, thus the second save overwrites the first: http://pastie.org/312212 the last example is effectively the same as the previous one although the two get calls inside the repository(:default) do .. block are bound to the same repository: http://pastie.org/312213 is this the desired behavior ?? if yes, I would like to add some specs and some documentation (working with repository scope), because it took me a while to understand what is going on. especially if I work with named repository and I have several repository(:myname) do .. end wrappers in different classes or methods, then I loose the common identity map. the only way to get this identity map back into place is to wrap everything in a repository(:myname) do repository(:default) do .. end; end which forces to have exactly one identity map for each named repository even when I have nested wrappers here or there. regards Kristian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
