If your controller action looks like this:
respond_to do |format| format.html { raise \'Unsupported\' } format.js # index.js.erb end
and yo
Use this before request:
@request.env['HTTP_ACCEPT'] = 'text/javascript'