I have a script that copies a bunch of db tables created by datamapper
from one mysql repository to another. It looks something like this -

----
model_names.each do |model|
  repository(:remote) {records = model.all}
  records.each do |record|
    # make a copy of record and save in the default repository
    ...
  end
end
----

I've been using this pretty successfully for nearly a year. However a
couple of the models are related by m2m relationships declared
with :through => resource and I've run into a problem that I haven't
seen before. In the past the list of models to be copied has included
the implicit join models. e.g. if I have ...

----
class Role
  include DataMapper::Resource
  has n, :permissions, :through => Resource
end

class User
  include DataMapper::Resource
  has n, :roles, :through => Resource
end
-----

... I've included RoleUser in the array model_names, and everything
has worked fine. However I tried it just now, and seems that RoleUser
is now not defined. Does this reflect some known change in the DM
code? If so I guess I'll have to find a work-around, but I'd like to
be sure that that's actually the cause of the issue before I proceed
further.

Mark.

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamap...@googlegroups.com.
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to