: Replaces Turbolinks to handle page transitions.
Allows standard tags to perform non-GET requests, such as POST , PATCH , or DELETE . This is critical for RESTful actions where links are preferred over buttons.
: A modest JavaScript framework for when you need custom client-side logic that UJS couldn't handle. How to Check if You Are Using Rails UJS
: Adding data-confirm to links to trigger native browser pop-ups before an action (like deleting a record) is executed.
The term "unobtrusive" is key. Instead of mixing JavaScript code directly into your HTML (e.g., onclick="submitForm()" ), Rails UJS uses a progressive enhancement approach. It binds event listeners to specific data- attributes, keeping your markup clean and your behavior separate.
<%= link_to "Click me!", "/remote_url", remote: true %>
When clicked, Rails UJS intercepts the click event, shows the browser confirmation dialog, and proceeds only if confirmed.