Sequel gem 的缺点

发布于 2024-07-25 16:57:54 字数 1542 浏览 5 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

岁月蹉跎了容颜 2024-08-01 16:57:54

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.

赠佳期 2024-08-01 16:57:54

您不必将 Sequel 与 Sinatra 一起使用。 西纳特拉是一个相当不可知论的人。

如果您对使用 ActiveRecord 感兴趣,那么它非常简单:
需要“红宝石”
需要“西纳特拉”
require 'active_record'

ActiveRecord::Base.establish_connection(
  :adapter => 'sqlite3',
  :database =>  'sinatra_application.sqlite3.db'
)

您可以在此处了解有关 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'

ActiveRecord::Base.establish_connection(
  :adapter => 'sqlite3',
  :database =>  'sinatra_application.sqlite3.db'
)

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.

时间你老了 2024-08-01 16:57:54

您可以查看 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.

ぶ宁プ宁ぶ 2024-08-01 16:57:54

您可以使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文