我的Sinatra应用程序在使用sqlite进行本地安装时工作正常。当移动到Heroku的,我有奇怪的错误,所以我在本地的应用程序切换到Postgres的,也和我收到这些错误:加载中IRB模型时切换到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
同样的情况。
这里是我的模型文件:
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吗? –
是的,我在Mac上,但看起来问题是Ruby 2.2.0。切换回2.1.5解决了这个问题。去搞清楚。 –