【发布时间】:2012-02-17 19:18:39
【问题描述】:
我想知道在 Sinatra 中以 DRY 方式设置配置块的正确方法是什么。我想要的是:
- 在生产中,不要显示异常和错误
- 在开发时,将查询记录到 DB
- 在测试时,使用内存中的 SQLite db。
我设置如下:
configure :production do
set :show_exceptions, false
set :raise_errors, false
end
configure :development do
DataMapper::Logger.new($stdout, :debug)
end
configure :test do
DataMapper.setup(:default, "sqlite::memory:")
end
但是要在基本configuration 块中添加什么?这是一个正确的方法吗?另外,我在 Sinatra 中找不到配置块的正确执行顺序。
【问题讨论】:
标签: ruby logging sinatra datamapper