質問

私は、現在のバージョンを使用したいバンドラする(0.8からと非常にいくつかの変更がありました0.9)私のRailsアプリの宝石を疥癬します。まず私は、appフォルダのルートにGemfileを作成し、そこに必要なすべての宝石を追加しました。 (マニュアルで推奨されているように)それから私は私の置かれconfig/environment.rbに次のコード:

begin
  # Require the preresolved locked set of gems.
  require File.expand_path('../.bundle/environment', __FILE__)
rescue LoadError
  # Fallback on doing the resolve at runtime.
  require "rubygems"
  require "bundler"
  Bundler.setup
end

bundle installは、それがYour bundle is complete!を終えて正常に動作するようです。私のアプリを起動するときしかし、私は次のエラーを取得する:

$ ruby script/server  
=> Booting WEBrick
=> Rails 2.3.5 application starting on http://0.0.0.0:3000
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant CouchRest (NameError)
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:80:in `const_missing'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:92:in `const_missing'
        from /home/kuf/data/Arbeit/Decodon/2009-05-08-Project_Orange/orangemix/fuse/config/initializers/couchdb.rb:35
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load_without_new_constant_marking'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
        from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:145:in `load'
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:622:in `load_application_initializers'
         ... 11 levels...
        from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from script/server:3

ここで何が間違っているのですか?

役に立ちましたか?

解決

Arrrgは、単に送信ボタンを押して、問題を解決した考えを持っていました。バンドラマニュアルは言う:「[...]あなたのコードの先頭に以下のものが含まれます。」

:Railsのアプリのためには、前にすべて正しく設定を取得するためにconfig/environment.rbの下部に言及した部分を配置する必要があります
RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION

require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
...
end

# Put the bundler related stuff here!
begin
  # Require the preresolved locked set of gems.
  require File.expand_path('../.bundle/environment', __FILE__)
rescue LoadError
  # Fallback on doing the resolve at runtime.
  require "rubygems"
  require "bundler"
  Bundler.setup
end
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top