2010-03-05 67 views
1

我按照步驟here並安裝了composite_primary_keys gem。當我嘗試要求的environment.rb寶石在文件的最底部(「結束」後)通過爲什麼在environment.rb中需要這個gem時會出錯?

require 'composite_primary_keys' 

我得到這個啓動服務器

"69125" 
=> Booting Mongrel 
=> Rails 2.3.4 application starting on http://127.0.0.1:3002 
/Library/Ruby/Site/1.8/rubygems.rb:270:in `activate': You have a nil object when you didn't expect it! (NoMethodError) 
You might have expected an instance of Array. 
The error occurred while evaluating nil.map 
from /Library/Ruby/Site/1.8/rubygems.rb:296:in `activate' 
from /Library/Ruby/Site/1.8/rubygems.rb:295:in `each' 
from /Library/Ruby/Site/1.8/rubygems.rb:295:in `activate' 
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in `require' 
from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' 
from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' 
from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' 
from /path/to/www/config/environment.rb:54 
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' 
from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' 
from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in' 
from /path/to/www/vendor/rails/activesupport/lib/active_support/dependencies.rb:156:in `require' 
from /path/to/www/vendor/rails/railties/lib/commands/server.rb:84 
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' 
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' 
from ./script/server:3 
from -e:2:in `load' 
from -e:2 

知道爲什麼這時候正在發生?

+0

什麼是對你的config/environment.rb中的54線? – Trevoke 2010-03-05 18:49:54

+0

需要'composite_primary_keys' – 2010-03-05 18:52:14

回答

3

嘗試把它在你的environment.rb中這樣的:

Rails::Initializer.run do |config| 

    config.gem 'composite_primary_keys' 

end 
+0

嗯,我認爲我的導軌安裝是搞砸了什麼的。現在,我甚至無法啓動服務器而無需進行任何更改。我是寶石更新,我們會看到會發生什麼。 – 2010-03-05 19:07:24

+0

現在我運行腳本/服務器時得到這個:Library/Ruby/Site/1.8/ruby​​gems.rb:220:在'activate':未定義的方法'map'爲nil:NilClass(NoMethodError) – 2010-03-05 19:09:06

+0

呃,你沒有擦除一切都在environment.rb中,是嗎?我剛剛給了你一個空白的例子,但還有一些其他的東西,適合在那裏,如時區設置..請編輯您的原始帖子與啓動服務器的完整錯誤日誌。 – Trevoke 2010-03-05 19:11:04

相關問題