I have a rails application where I am trying to have jQuery render WITH an HTML file. The point of this is that the jQuery is specific to the page so I don\'t want it loading f
From what i understand, you want to have new.html and new.js to be served when requesting /messages/new.
It will not work, the rails controller will use js or HTML and never both. HTTP does not work like that. You have only one file that is send in response to an HTTP request and you cannot send 2 at the same time.
The purpose of the respond_to block of the action is to use html for html request (classic browsing) and js when the request is for js, and that's what you use for ajax.
For what you want, you need to add a js reference in your erb, there is no other way.