title: jQuery UI Dialog instead of alert() for Rails 3 data-confirm attribute
body: <p>In Rails 3, passing a :confirm parameter to link_to will populate the data-confirm attribute of the link. This will induce a JS alert() when the link is clicked. </p>
  
  <p>I am using the rails jQuery UJS adapter (<a href="https://github.com/rails/jquery-ujs" rel="noreferrer">https://github.com/rails/jquery-ujs</a>). The relevant code from rails.js is:</p>
  
  <pre><code>$('body').delegate('a[data-confirm], button[data-confirm], input[data-confirm]', 'click.rails', function () {
      var el = $(this);
      if (el.triggerAndReturn('confirm')) {
          if (!confirm(el.attr('data-confirm'))) {
              return false;
          }
      }
  });
  </code></pre>
  
  <p>and</p>
  
  <pre><code>triggerAndReturn: function (name, data) {
          var event = new $.Event(name);
          this.trigger(event, data);
  
          return event.result !== false;
      }
  </code></pre>
  
  <p>I would like to know how this could be modified to instead yield a jQuery dialog (e.g. <a href="http://jqueryui.com/demos/dialog/#modal-confirmation" rel="noreferrer">the jQuery UI Dialog</a>) allowing the user to confirm or cancel.</p>
  
  <p>My knowledge of JavaScript isn't sufficient to achieve this elegantly. My current approach would be to simply rewrite the $('body').delegate() function to instead instantiate a lightbox. However I imagine that there is a more effective approach than this.</p>