我正在使用Ruby 1.9.3和Rails 3.2.17来完成这个项目。我计划升级到Rails 4但遇到很多gem不兼容,所以我首先尝试更新一些gem。 我正在将formtastic从2.0.2更新到3.1.3。
我看到很多这样的弃用警告:
DEPRECATION WARNING: input_class is deprecated and will be removed from Formtastic 4.0 (configure Formtastic::FormBuilder.input_class_finder instead (upgrade guide on wiki: http://bit.ly/1F9QtKc )). (called from _app_views_prescriptions__fields_html_haml___278490936240938991_103076320 at /home/hegwin/Workspace/rails_projects/pharmmd/app/views/prescriptions/_fields.html.haml:7)
我跟随了formtastic wiki Upgrading to Formtastic 3.1,我将这两行添加到config/initializers/formtastic.rb
Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
之后当我尝试运行rspec时,它引发了一个错误:
NoMethodError: undefined method `eager_load' for #<Rails::Application::Configuration:0x00000006306a50>
/home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `eager_load' for #<Rails::Application::Configuration:0x00000006459b50> (NoMethodError)
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:32:in `use_const_defined?'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:69:in `<class:NamespacedClassFinder>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:24:in `<module:Formtastic>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/formtastic-3.1.3/lib/formtastic/namespaced_class_finder.rb:1:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/formtastic-3.1.3/lib/formtastic/action_class_finder.rb:7:in `<module:Formtastic>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/formtastic-3.1.3/lib/formtastic/action_class_finder.rb:1:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/config/initializers/formtastic.rb:104:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:50:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/zeus-0.13.3/lib/zeus/load_tracking.rb:43:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `block in load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:245:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/engine.rb:592:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `instance_exec'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `run_initializers'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/application.rb:136:in `initialize!'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/railties-3.2.17/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/hegwin/Workspace/rails_projects/pharmmd/config/environment.rb:5:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/spec_helper.rb:12:in `require'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/spec_helper.rb:12:in `<top (required)>'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/features/patient_edit_medication.feature:1:in `require'
from /home/hegwin/Workspace/rails_projects/pharmmd/spec/features/patient_edit_medication.feature:1:in `<top (required)>'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /home/hegwin/.rvm/gems/ruby-1.9.3-p362@medpro/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'