Suppose I make an ajax a call, from which I want to get some static template (app/views/static/some_template.html.erb), on which I want to act with some javascript stored here app/views/layouts/sign_in.js.erb. Is it possible to render multiple file ? (because I want to keep separate my js files and my html files)
def ajax_call
respond_to do |format|
...
format.js {render 'layouts/sign_in.js.erb'}
end
end
Edit : here's my controller
respond_to do |format|
format.js {render 'devise/sessions/new.html.erb'}
end
In devise/sessions/new.html.erb, I put
<div> test</div>
<%= render "layouts/sign_in.js.erb" %>
and in layouts/sign_in.js.erb, I put console.log('test');