Skip to content Skip to sidebar Skip to footer

Execjs::runtimeerror In Rails 3.2.8 Engine With Javascript_include_tag

We are putting two rails 3.2.8 engines together in one rails app. The problem is that ExecJS does not like namespace for javascript_inclide_tag in layouts file. Here is the tag whi

Solution 1:

See this question: Using javascript_include_tag with a Subfolder full of JS

Can you have an initializer for each engine? In which case you could have:

Initializer for one (call it authentify) - e.g. authentify.rb as one initializer for engine A:

ActionView::Helpers::AssetTagHelper.register_javascript_expansion :authentify => Dir["#{Rails.root.to_s}/public/javascripts/authentify/*.js"].each {|js| js.gsub!("#{Rails.root.to_s}/public/javascripts/",'')}

Initializer for the other (call it authentify2) - e.g. authentify2.rb as one initializer for engine B:

ActionView::Helpers::AssetTagHelper.register_javascript_expansion :authentify2 => Dir["#{Rails.root.to_s}/public/javascripts/authentify2/*.js"].each {|js| js.gsub!("#{Rails.root.to_s}/public/javascripts/",'')}

and then you can have:

<%= javascript_include_tag :authentify %>

in one layout and:

<%= javascript_include_tag :authentify2 %>

in the other, and just remove the <%= javascript_include_tag 'authentify/application' %> in your layout as well as the other javascript_include_tag tag for your other engine.

Solution 2:

The issue is that execjs does not work on windows 8. Here is a post about how to go into the execjs runtimes and fix it on windows 8.

Post a Comment for "Execjs::runtimeerror In Rails 3.2.8 Engine With Javascript_include_tag"