Your example is exactly what we have, and it doesn't work in repo
blocks.

We have something like:
class Account
   include DataMapper::Resource
  # implicitly assigned :default, which is mysql adapter
...
end

and

class Role
   include DataMapper::Resource
    def self.default_repository_name;:in_memory;end
end

When code involving both Account and Role are put into the same
repository block, the Role's repository is overridden to mysql
adapter.

-Gary


On Jan 27, 3:01 pm, "[email protected]" <[email protected]>
wrote:
> The model can know which adapter to use be default. Its pretty ugly at
> the moment, but you need to do something like:
>
> class MyModel
>   include DataMapper::Resource
>   def self.default_repository_name
>     :other_adapter
>   end
>
>   property ...
> end
>
> This will use the :other_adapter for this model by default.
>
> Paul
>
> On Jan 27, 12:58 pm, Gary Yngve <[email protected]> wrote:
>
> > we just got hosed by the merb upgrade which put repository blocks around
> > each action, because we use at least three different adapters in our
> > project, and often two of them in an action (e.g. lightweight stuff like
> > authorization that happen all the time are in the in-memory adapter).
> > is there a way to easily make a repo block that works simultaneously on two
> > adapters?
>
> > or make a repository take a set of adapters and a model knows which adapter
> > in the repo it uses?
>
> > thanks,
> > gary
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to