So I've figured out how to get multiple repositories setup just fine,
but I'm having trouble when it comes to getting the right data in the
right place.
I have figured out how to set the repository for a model using
self.default_repository_name. So I have one model, Order, in
my :external repository. I have defined a couple fields, and that's
ALL I want it to contain in that database (an ID, an amount).
However, in the :default repository, I want to define, for instance, a
User to which an Order belongs, and I don't want that data to be
stored in the :external repository, I want to add it in my :default
repository. I tried this:
class Order
include DataMapper::Resource
def self.default_repository_name
:external
end
property :id, Serial
property :amount, Integer
belongs_to :user, :repository => repository(:default)
end
But the "user_id" field still ends up on the orders table in
the :external repository. Is this possible??
The use-case is that I want to create a gem that has its own
repository, and can be used by multiple client apps, but still be able
to define relationships to the models in that gem in each client app
without modifying the gem's repository.
--
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.