We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
AFAIK,您并不被迫将 Sequel 与 Sinatra 一起使用。 如果您愿意,可以使用 Datamapper 或其他 ORM。
AFAIK, you are not forced to use Sequel with Sinatra. If you wish you can use Datamapper or an other ORM.
您不必将 Sequel 与 Sinatra 一起使用。 西纳特拉是一个相当不可知论的人。
如果您对使用 ActiveRecord 感兴趣,那么它非常简单:
需要“红宝石”
需要“西纳特拉”
require 'active_record'
您可以在此处了解有关 ActiveRecord 和 Sinatra 的更多信息。 还有一个 gem sinatra-activerecord 可以处理一些样板文件。
如果您想要比 Sequel 功能更全面的东西,但对使用 ActiveRecord 不感兴趣,还有 Ruby Object Mapper (rom-rb),它是 DataMapper 模式的一个非常好的实现。
You don't have to use Sequel with Sinatra. Sinatra is pretty agnostic.
If you are interested in using ActiveRecord its pretty straightforward:
require 'rubygems'
require 'sinatra'
require 'active_record'
You can read more about ActiveRecord and Sinatra here. There is also a gem sinatra-activerecord that handles some of the boilerplate.
There is also the Ruby Object Mapper (rom-rb) which is a pretty nice implementation of the DataMapper pattern if you want something more fully featured than Sequel, but aren't interested in using ActiveRecord.
您可以查看 Padrino。 它是一个轻量级框架,带有 Sinatra 核心,开箱即用地支持多个 ORM。
You might check out Padrino. It's a lightweight framework with a Sinatra core that supports several ORMs right out of the box.
您可以使用 DataMapper 或 ActiveRecord,或者只是普通的 DBI。 Sinatra 没有对特定 ORM 框架的任何集成支持。
You can use DataMapper or ActiveRecord, or just plain DBI. Sinatra does not have any integrated support for a specific ORM framework.