An question from newbie, How to use multiple database with DM

27 views
Skip to first unread message

Roy Zhu

unread,
Sep 23, 2013, 12:05:39 AM9/23/13
to datam...@googlegroups.com
Hi all,
    I have an Question , How to use multiple database in padrino?
DataMapper.setup(:db1,xx,xx,xx)
DataMapper.setup(:db2,xxx,xxx,xxx)

class M
  include DataMapper::Resource
  # I want use db1 for this Model
end

class N
  include DataMapper::Resource
  # I want use db2 for this Model
end

How I do it?
Thx

christian

unread,
Sep 23, 2013, 8:59:16 AM9/23/13
to datam...@googlegroups.com
class N
  include DataMapper::Resource

  def self.default_repository_name
    :db2
  end
end

should do the trick which hard wires the model N to datastore db2.

- christian
Reply all
Reply to author
Forward
0 new messages