Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup javascript files as :defaults in rails 4?

My current RoR application using rails 3.2.10 and I want to upgrade it on rails 4.0.0.

I solve the gem dependence but when I run the rails server it give the error :-

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

My config/application.rb file has this code at line 39.

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

for that what should do- change the code or remove, any dependence or any other option.

Rails 4 also support assets precompile so I comment the this line:-

#config.assets.enabled = true   In rails 4 assets pipline enable by default
like image 291
Gaurav Sharma Avatar asked Jul 17 '13 12:07

Gaurav Sharma


1 Answers

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: ""

like image 164
bjelli Avatar answered Oct 05 '22 18:10

bjelli