I'm working with a sinatra app and I want to declare multiple
datamapper repositories and choose which one should be the default
based on whether my app is running in development or production mode.
Here is my code:

DataMapper.setup(:development, "sqlite3://#{$ROOT_DIR}/dev.db")
DataMapper.setup(:production, {
  :adapter  => 'mysql',
  :host     => 'localhost',
  :username => 'XXXXXXXXXX',
  :password => 'XXXXXXXXXX',
  :database => 'pacman_production'
})
configure :development do
  DataMapper::Logger.new(STDOUT, :debug)
  DataMapper.setup(:default, repository(:development).adapter.options)
end
configure :production do
  DataMapper.setup(:default, repository(:production).adapter.options)
end

This works, but is this syntax a good way of doing it, or does anyone
have a better suggestion?

My reason for wanting both repos is so that I can copy data in between them.

Thanks,
Carl

-- 
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