0

当我在 application.rb 中有以下行时,我的 rails 应用程序无法加载:

Bundler.require(:default, Rails.env)

我收到以下错误:

.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:13:in `[]': no implicit conversion of Symbol into Integer (TypeError)
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:13:in `initialize'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:85:in `new'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/initializable.rb:85:in `initializer'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:6:in `<class:Railtie>'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:5:in `<module:Rolify>'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@rails-4.0/gems/rolify-3.3.0/lib/rolify/railtie.rb:4:in `<top (required)>'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@rails-4.0/gems/rolify-3.3.0/lib/rolify.rb:1:in `<top (required)>'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `each'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler/runtime.rb:72:in `block in require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `each'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler/runtime.rb:61:in `require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.1/lib/bundler.rb:131:in `require'
    from /Users/gerardkelly/Web Development/Rails Apps/Rails 4/po-app/config/application.rb:5:in `<top (required)>'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/commands.rb:74:in `require'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/commands.rb:74:in `block in <top (required)>'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/commands.rb:71:in `tap'
    from /Users/gerardkelly/.rvm/gems/ruby-2.0.0-p353@global/gems/railties-4.0.2/lib/rails/commands.rb:71:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

看起来好像它在抱怨发送的参数 - 这很奇怪,因为这是预先烘焙的 Rails 东西。请注意,Bundler.require 是它抱怨的 application.rb:5。

我在 Rails 4,Ruby 2.0.0

4

1 回答 1

2

看起来您正在使用的 rollify gem(所以它不是干净的 rails 项目:P)在 rails 4.x 系列中有一些问题。看看这个:https ://github.com/EppO/rolify/pull/218有一个叉子已经解决了这个问题。

于 2014-01-27T14:26:50.753 回答