Я установил некоторые новые драгоценные камни для тестирования и столкнулся с неинициализированной постоянной ошибкой ActionController :: Dispatcher :: MiddlewareStack. Я выполнил инструкции на gem rdocs, указав зависимость gem в файле environment.rb, а затем запустил грабли: установить и грабли gems: unpack.uninitialized constant ActionController :: Dispatcher :: MiddlewareStack
Я также скопировал через файл environment.rb по одной строке за раз в другой проект, и я не получил ошибку. Мне было интересно, что еще может произойти неправильно.
Вот длинная версия ошибки (я первый столкнулся с ошибкой работает простой тест, то же самое происходит и в консоли, когда я требовать «active_support»):
$ ruby test/unit/user_test.rb
** has_many_polymorphs: rails environment detected
/Users/thaiyoshi/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in `const_missing': uninitialized constant ActionController::Dispatcher::MiddlewareStack (NameError)
from /Users/thaiyoshi/.gem/ruby/1.8/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:71
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /Users/thaiyoshi/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /Users/thaiyoshi/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/thaiyoshi/.gem/ruby/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:156:in `require'
from /Users/thaiyoshi/.gem/ruby/1.8/gems/has_many_polymorphs-2.13/lib/has_many_polymorphs/autoload.rb:2
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
... 8 levels...
from ./test/unit/../test_helper.rb:2:in `require'
from ./test/unit/../test_helper.rb:2
from test/unit/user_test.rb:1:in `require'
from test/unit/user_test.rb:1
Вот мое окружение. гь файл (по умолчанию комментарии удалены):
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# config.gem 'has_many_polymorphs', :version => "2.12"
# require ‘has_many_polymorphs‘
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
require 'has_many_polymorphs'
require 'active_support'
Rails::Initializer.run do |config|
config.time_zone = 'UTC'
config.gem "thoughtbot-factory_girl",
:lib => "factory_girl",
:source => "http://gems.github.com"
config.gem 'thoughtbot-shoulda',
:lib => false,
:source => 'http://gems.github.com'
end
Я думаю, что это связано с линией, требующей «has_many_polymorphs». Я совместил go_many_polymorphs с rails 2.3.2, но не нашел ничего определенного. – sutee
Вы пытались установить один камень за раз? Кроме того, вы можете создать новый секрет, теперь, когда вы поделились им со всеми нами: P. – allyourcode