0

I have just built an app in rails and am trying to install a mailing system to the client and server side. When I try to run the application, the system states that the file cannot be found in the application.js file. Here is the error statement:

ActionView::Template::Error (couldn't find file 'global' with type '   application/javascript'):
3: <head>
4:   <meta charset="utf-8">
5:   <title>Vumos</title>
6:   <%= stylesheet_link_tag    'application', 'global', media: 'all', 'data-turbolinks-track' => true %>
7:   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
8:   <%= csrf_meta_tags %>
9: </head>
app/assets/javascripts/application.js:17
app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb__160887971_97469592'

I the file 'global' stored at the base of the file tree, not in a folder. If this is the problem, which folder would I put this file in? If not, how do I include the file in the application.js file?

1
  • Can you share a screenshot of the directory breakdown and application.js content ? Commented Mar 22, 2016 at 20:03

1 Answer 1

1

There should be a file called global.js or global.coffee under the app/assets/javascripts/ path, also, you should add the following require statement to application.js:

//=require global

Note: you could also use //= require_tree . on the application.js file to require all files on the javascripts folder, but it is usually best to require your file before that statement to ensure loading order.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for that answer. The app is now running smoothly and securely due to that line in the application.js file.
I am glad that worked for you, if you could upvote the answer for such reason.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.