I'm making a page that needs real-time data.
So, it needs a repeatable ajax communication after page loads.
like this,
jQuery ->
setInterval ->
$.ajax
url: "some url"
success: (data, textStatus, jqXHR) ->
#handle the data here
the problem occurs here,
i only need this code in one page
but because of this in application.js
require_tree .
it loads the whole coffeescript(javascript) code in every pages.
How do i include this coffeescript file in only one page?
Do i have to manually include the javascript in .erb
file like this?
<%=javascript_include_tag 'what_i_want'%>
Is this the right way?