我的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解決了這個問題。去搞清楚。 –