Ruby on Rails
Thursday, June 18, 2015
Check out RailsCasts:
On Thursday, June 18, 2015 at 2:41:53 AM UTC-4, Jonathan Allard wrote:
-- Ruby on Rails - Railscasts PRO #136 jQuery & Ajax (revised)
https://www.youtube.com/watch?v=FBxVN7U1Qsk
On Thursday, June 18, 2015 at 2:41:53 AM UTC-4, Jonathan Allard wrote:
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.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/90937890-5659-40b4-a12e-fe086fa11f15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment