Hi! As we have front controller and admin controller I think its logicaly to have 2 js files to divide front and admin usage js functionality. I tried <?= $asset_tag_helper->javascript_for_current_controller() ?> but its included just front js file up to <head>. How could I include admin js. I don't need <?= $asset_tag_helper->javascript_include_tag(); ?> because this method doesn't put up <script> to <head>, but just includes:( Tnx:)
CommentAuthorpogeybait4883
Your javascript files should go in the public/javascripts folder in your app.
In your view, hopefully in your /app/view/layouts folder where you have your layout, you can use: <%= javascript_include_tag 'prototype' %>
The above example assumes you have a js file called public/javascripts/prototype.js . The source generated on your page would look like this: <script src="/javascripts/prototype.js" type="text/javascript"></script>
If a js file has any periods in it besides the ".js" such as "yahoo.color.js", you'll have to specify that like this: <%= javascript_include_tag 'yahoo.color.js' %>
You dont necessarily have to use layouts but I would recommend looking into them. Also note this is the rails way of including a javascript file so you dont have to use the asset_tag_helper. Hope this helps.