rails-ujs

15 Mar 2018 | | rails

Rails-UJS

Rails-ujs was formerly JQuery-ujs but the JQuery dependency was removed hence the name change.

form_with

Rails 5.1 added form_with form helper method that provides capabilities of form_for and form_tag. Rails unified form_for and form_tag that provide similar interfaces to generate forms with form_with helper.

Now we can use form_with for both model and non-model based forms.

If your application uses rails-ujs, the form will be submitted via ajax, and it listens on following events.

Event can be binded on form as given below.

$(document).on('ajax:success', '#new_user', function(e) {
  console.log('form_with: successfully submitted form via ajax');
});
         
$(document).on('ajax:error', '#new_user', function(e) {
  console.log('form_with: error submitting form via ajax');
});
comments powered by Disqus(comments off)

Older · View Archive (32)

turbolinks

… there’s a big difference between a) keeping up with open source, and b) hitching your cart to every horse that struts by with shiny new shoes…Jerod Santo/changelog.com

Turbolinks(3.0 latest) and SPA type behaviors

Newer

node event loop

the node event loop in a nutshell

I have a few other posts on the workings of node(lowrider.libuv) but this pull things together for a common GROK.