This blog is part of our Rails 5.1 series.
Rails has been dependent on jQuery
and the Ajax
Every Rails application before Rails 5.1
would have the
jquery-rails gem included by default.
jquery-rails gem contains the jquery-ujs
driver which provides all the nice unobtrusive features.
That’s what has happened for the 5.1 release. The
as part of a GSoC project by Dangyui Liu.
approach would still be
available. It’s just that it’s not
part of the default stack.
You will need to manually add the
to newly created 5.1 application
and update the application.js to include the
It’s worth noting that
rails-ujs only supports IE 11+.
Visit the Desktop Browser Support
section of Basecamp to see the full list of all the supported browsers.
Browsers support without jQuery
We saw some discussion about which all browsers are supported without jQuery. We decided to test it outselves on a plain vanilla CRUD Rails app. We tested “adding”, “editing” and “deleting” of a resource.
We found that all three operations (adding, editing and deleting) to be working in following cases.
- Win 7 - IE 9
- Win 7 - IE 10
- Win 7 - IE 11
- Win 8 - IE 10
- Win 8.1 - IE 11
- Win 10 - IE 14 Edge
- Win 10 - IE 15 Edge
- Win 10 - Firefox 53
- Win 10 - Chrome 58
- Win 10 - Safari 5.1
- Mac Siera - Safari 10.1
- Mac Sierra - Firefox 53
- Mac Sierra - Chrome 58
API change for the event handlers
rails-ujs driver has changed the signature of the event handler functions
to just pass one
event object instead of
as in the case of
Check the documentation for the rails-ujs event handlers for more details.