【发布时间】:2015-03-15 09:02:03
【问题描述】:
我的 Sinatra 应用在使用 sqlite 进行本地安装时运行良好。迁移到 Heroku 后,我遇到了奇怪的错误,因此我也切换到本地应用程序中的 Postgres,并且收到以下错误:
dyld: lazy symbol binding failed: Symbol not found: _rb_thread_select
Referenced from: /Users/Emanuele/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/do_postgres-0.10.14/do_postgres/do_postgres.bundle
Expected in: flat namespace
dyld: Symbol not found: _rb_thread_select
Referenced from: /Users/Emanuele/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/do_postgres-0.10.14/do_postgres/do_postgres.bundle
Expected in: flat namespace
在 irb 中加载模型时也会发生同样的情况。
这是我的模型文件:
require 'data_mapper'
require 'dm-types'
require 'dm-validations'
require 'dm-postgres-adapter'
require 'bcrypt'
# Setup DataMapper with a database URL. Will use ENV['DATABASE_URL'] on Heroku.
DataMapper.setup(:default, 'postgres://localhost/myapp')
# Let's define the model
class User
include DataMapper::Resource
include BCrypt
property :id, Serial, :key => true
property :email, String, :length => 5..70, :unique => true, :required => true, :format => :email_address
property :password, BCryptHash
property :account_sid, String, :length => 34
property :auth_token, String, :length => 32
property :app_sid, String, :length => 34
def authenticate(attempted_password)
if self.password == attempted_password
true
else
false
end
end
end
# Finalize the DataMapper model.
DataMapper.finalize
# Tell DataMapper to update the database according to the definitions above.
DataMapper.auto_upgrade!
当我切换回 sqlite3 时,应用程序再次开始工作。我无法找到错误。在线搜索没有任何结果。
有没有人知道发生了什么以及如何解决这个问题并在 Heroku 上发布我的应用程序?
如果您需要更多信息,请询问。
谢谢!
【问题讨论】:
-
是的,我使用的是 Mac,但看起来问题出在 Ruby 2.2.0 上。切换回 2.1.5 解决了这个问题。去图吧。
标签: sqlite postgresql heroku sinatra datamapper