I am trying to load some javascript on my application page using a named yield block, but the code is duplicated due to the overall profitability loading my view pages. something like that:
----- The code present in the views -----
<% content_for :bottom_scripts do %>
<script type="text/javascript">
Some Javascripts
</script>
<% end %>
------ Code on my application page -----
<div id = "body">
<%= yield %>
</div>
<%= yield :bottom_scripts %>
The script code prints twice, but I just need to print it in the second lesson, any thoughts?
source
share