Ujs in rails

252 views

Published on

  • Be the first to comment

  • Be the first to like this

Ujs in rails

  1. 1. UJS in Rails
  2. 2. UJS in RailsInstead of inserting inline JS, Rails 3 uses HTML5data-attributes
  3. 3. Sample= link_to “delete”, posts_path(@post), :method => “delete”, :confirm => “Areyou sure?”…will render as:<a href=“/posts/1” data-confirm=“Are you sure?” data-method=“delete”>delete</a>
  4. 4. No more ‘remote’ helpers (link_to_remote,remote_form_for, et al., are gone)
  5. 5. :remote
  6. 6. Sample= form_for(@posts, :remote => true)…will render as<form action=“http://post/path” method=“post” data-remote=“true”></form>
  7. 7. Questions?

×