Confusion around form_for defaults and json/js

With Convention over configuration, you can usually trust the defaults to get you there. In this case, not so much. I’ve been banging my head on the wall for a few hours now, in between trying things and researching.

For the usual cases, how do I set up an AJAX form. Is it using JS or JSON format?

Case 1: form_for remote: true default, format.js

UJS sends a request as JS.
Exception: Missing template for update.js.

form_for remote: true, format: :json

No difference in HTML output, though form_for doc examples says you can do that.

Case 2: form_for remote: true, html: {"data-type" => :json} not the default

Responder will answer 204, but why is this not default in either form_for or UJS?

What is the expected use case and can it be documented? I suspect it’s the latter, but I expected there to be good defaults in place.

Check out RailsCasts:

Ruby on Rails - Railscasts PRO #136 jQuery & Ajax (revised)

https://www.youtube.com/watch?v=FBxVN7U1Qsk

Railscasts does a lot of configuration before having it working. Why is there not a functioning default?

I’ll include the ASCIIcast for brevity for others: http://asciicasts.com/episodes/136-jquery