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

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

I solve the gem dependency, but when I start the rails server it gives an error: -

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

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

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

To do this, you need to change the code or delete any dependency or any other option.

Rails 4 also supports pre-compilations, so I will comment on this line: -

 #config.assets.enabled = true In rails 4 assets pipline enable by default 
+7
javascript ruby ruby-on-rails-3 ruby-on-rails-4 gem
source share
1 answer

if you switch to using the asset pipeline, you should not use javascript_include_tag: the default is no longer in your templates, and you no longer need to set this configuration parameter.

See javascript_include_tag on apidoc : ""

+3
source share

All Articles