I am adding some view specific .js code to the header of the page using content_for like so
<% content_for :head do %>
<script lang="text/javascript">
$.getJSON("<%= book_chapters_path(@book) %>", function(data){
});
</script>
<% end %>
now how would I switch that js code to coffescript, can I put in a code block to tell rails to convert it to javascript, or even just add “lang/coffeescript” and rails would then just handle it.
You can use this gem: https://github.com/markbates/coffeebeans