0

Rails 3.2.6

It is my understanding that by having all javascripts in the /app/assets/javascripts, they are accessible to the application modules. I was following a tutorial, and at the end of application.html.erb, they added the following line:

<%= javascript_include_tag "application" %>

Is this redundant, or is there a purpose for including it at the end of application.html.erb?

2 Answers 2

1

Assets are not included in your views by default. That is why you have to use javascript_include_tag, stylesheet_link_tag in layout file. As to why it is added at the end - to improve page load time. more about it here

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

Comments

1

The reason for putting the javascript_include_tag at the end of the application.html.erb file is so that the content of the page is loaded first, then the javascript will be loaded. You can do it either way, but performance is better when you put the javascript_include_tag at the end.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.