Heroku +西纳特拉 +数据映射器

发布于 2024-10-01 09:03:48 字数 661 浏览 0 评论 0原文

我在将 Sinatra + DataMapper 应用程序部署到 Heroku 时遇到问题。该应用程序可以在本地运行,但部署时会崩溃。

错误如下:

不推荐使用带有显式 :serial 选项的 Integer id,请改用 Serial (./hello.rb:15) /home/slugs/339253_c667ceb_65a5-45e31e8c-0236-4d03-96ec-a59bdabdf788/mnt/.gems/gems/dm-migrations-1.0.2/lib/dm-migrations/adapters/dm-postgres-adapter.rb:84: in `property_schema_hash': bad value for range (ArgumentError)

代码如下所示:

Class Post
  include DataMapper::Resource

  property :id,    Integer, :serial => true
  property :title, String
end

Post.auto_migrate!
first_post = Post.new
first_post.title = "First!"
first_post.save

这是一个 gem 版本控制问题,还是我遗漏了一些东西?

Im getting issues deploying my Sinatra + DataMapper app to Heroku. The app works locally but deploying it blows up.

Here's the error:

Integer id with explicit :serial option is deprecated, use Serial instead (./hello.rb:15)
/home/slugs/339253_c667ceb_65a5-45e31e8c-0236-4d03-96ec-a59bdabdf788/mnt/.gems/gems/dm-migrations-1.0.2/lib/dm-migrations/adapters/dm-postgres-adapter.rb:84:in `property_schema_hash': bad value for range (ArgumentError)

The code looks like this:

Class Post
  include DataMapper::Resource

  property :id,    Integer, :serial => true
  property :title, String
end

Post.auto_migrate!
first_post = Post.new
first_post.title = "First!"
first_post.save

Is this a gem versioning issue, or am I missing something?

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

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

发布评论

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

评论(4

脱离于你 2024-10-08 09:03:48

您似乎在本地使用了另一个版本的 datamapper 。

使用以下命令检查本地版本:gem list --local

还可以使用 Serial 而不是建议的 Integer。

You use another version of datamapper locally it seems.

Check your local version with: gem list --local

Also use Serial instead of Integer as proposed.

轻许诺言 2024-10-08 09:03:48

试试这个:

Class Post
  include DataMapper::Resource

  property :id,    Serial
  property :title, String
end

Try this instead:

Class Post
  include DataMapper::Resource

  property :id,    Serial
  property :title, String
end
蓝颜夕 2024-10-08 09:03:48

您在本地和 Heroku 上使用相同版本的 DM 吗?

Do you use the same version of DM locally and on heroku?

双手揣兜 2024-10-08 09:03:48

您是否进行了捆绑安装,然后提交了 Gemfile 和 Gemfile.lock?如果不是heroku,就不知道您想使用哪些宝石,因此只需使用它的默认系统宝石。我猜他们不太匹配,这就是它爆炸的原因。

Did you do Bundle Install and then commit your Gemfile and Gemfile.lock? if not heroku woudln't have known which gems you wanted to use so just used it's default system gems. I guess they didn't quite match and that's why it exploded.

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