4

在我尝试从 4.1.8 升级到 rails 4.2.0.rc1 时,运行服务器时出现以下错误:

joshRpowell@Joshuas-MacBook-Air:~/MyProjects/rentlit-app[hook]$ rails s
/Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/inherited_resources-1.5.1/lib/inherited_resources/responder.rb:2:in `<module:InheritedResources>': uninitialized constant ActionController::Responder (NameError)
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/inherited_resources-1.5.1/lib/inherited_resources/responder.rb:1:in `<top (required)>'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/inherited_resources-1.5.1/lib/inherited_resources.rb:4:in `<top (required)>'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/bundler/gems/active_admin-951f35d6799a/lib/active_admin.rb:10:in `<top (required)>'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/bundler/gems/active_admin-951f35d6799a/lib/activeadmin.rb:1:in `require'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/bundler/gems/active_admin-951f35d6799a/lib/activeadmin.rb:1:in `<top (required)>'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `require'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `each'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:72:in `block in require'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `each'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler/runtime.rb:61:in `require'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.7.7/lib/bundler.rb:133:in `require'
from /Users/joshRpowell/MyProjects/rentlit-app/config/application.rb:7:in `<top (required)>'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/railties-4.2.0.rc1/lib/rails/commands/commands_tasks.rb:78:in `require'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/railties-4.2.0.rc1/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/railties-4.2.0.rc1/lib/rails/commands/commands_tasks.rb:75:in `tap'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/railties-4.2.0.rc1/lib/rails/commands/commands_tasks.rb:75:in `server'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/railties-4.2.0.rc1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/joshRpowell/.rvm/gems/ruby-2.1.5@rails4.2/gems/railties-4.2.0.rc1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

在我的 application.rb 文件中,我有以下内容:

require File.expand_path('../boot', __FILE__)

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)

module Rentlit
  class Application < Rails::Application

    config.generators.helper = false
    config.generators.assets = false
    config.generators.view_specs = false
  end
end

有关如何排除故障的任何建议?

4

3 回答 3

8

他们已经解决了:https ://github.com/josevalim/inherited_resources/commit/6d034d913bfd9b53ea2e5b31c4056578a1b170a4 。我正在使用带有 rails 4.2.1 的最新 gem 版本,它工作正常。

对于遇到问题的任何人,请尝试bundle update inherited_resources.

老答案:

您必须使用 rails 4.2 的特定分支:

gem 'inherited_resources', github: 'josevalim/inherited_resources', branch: 'rails-4-2'
于 2014-12-21T19:26:15.357 回答
5

我在这里不完全确定,但我知道它action_controller/metal/responder.rb在 4.2 中已从 rails 中删除,并且几乎直接复制到respondersgem 的action_controller/responder.rb. 您可以尝试添加gem 'responders', '~> 2.0'到您的 Gemfile 以查看是否可以修复它。

FWIW:

于 2014-12-10T23:22:49.703 回答
1

至于现在,只需运行

bundle update inherited_resources
于 2015-06-18T13:27:17.243 回答