7

我当前使用 rails 3.2.10 的 RoR 应用程序,我想在 rails 4.0.0 上升级它。

我解决了 gem 依赖,但是当我运行 rails 服务器时,它给出了错误:-

undefined method `[]=' for nil:NilClass
config/application.rb:39:in `<class:Application>'

我的 config/application.rb 文件在第 39 行包含此代码。

#JavaScript files you want as :defaults (application.js is always included).
config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

为此应该做什么-更改代码或删除任何依赖项或任何其他选项。

Rails 4 也支持资产预编译,所以我评论了这一行:-

#config.assets.enabled = true   In rails 4 assets pipline enable by default
4

1 回答 1

3

if you switch over to using the asset pipeline you should not use javascript_include_tag :defaults any more in your templates, and you don't have to set this configuration option any more.

See the javascript_include_tag on apidoc: ""

于 2013-07-17T12:55:50.313 回答