I am new to rails, I know that we add our css and js files in application.html.erb file.
But do we also add the js scripts in the same file?
For example this script below
<script>
$(function () {
$("#slider").responsiveSlides({
auto: true,
speed: 500,
namespace: "callbacks",
pager: true,
});
});
</script>
You can add any scripts in application.html.erb, but i think will be better to require application.js in application.html.erb with javascript_include_tag:
<%= javascript_include_tag "application" %>
and include any scripts from javascript folder in application.js
//= require library_name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With