Subscribe Favorite

jRails: jQuery On Rails

Written on December 11, 2007 by Eka Riyanti

Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library.

jRails is a drop-in jQuery replacement for Prototype/script.aculo.us on Rails. It has the features and the visual effect.The visual effects in jRails are based on the new jquery-fx library. jRails currently uses a slightly modified version of jquery fx code to get some of the desired effects.

Features of jRails :

jRails provides drop-in functionality for these existing Rails methods.

    • Scriptaculous
    • draggable_element
    • drop_receiving_element
    • sortable_element
    • visual_effect
    • RJS
    • hide
    • insert_html
    • remove
    • replace
    • replace_html
    • show
    • toggle

How to use it?

Just install and go! Once installed, the previous Prototype/script.aculo.us helpers will be replaced by jQuery ones. In order for them to function correctly, just include the appropriate javascript files in the head of your page.

 

<script src="/javascripts/jquery.js" type="text/javascript"></script>
<script src="/javascripts/jquery-ui.js" type="text/javascript"></script>
<script src="/javascripts/jquery-fx.js" type="text/javascript"></script>
<script src="/javascripts/jrails.js" type="text/javascript"></script>

You can also use the Rails javascript_include_tag helper with :default to load them automagically.

 

<%= javascript_include_tag :defaults %>

Visit jRails home page to find out more!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
If you enjoyed this post Subscribe to our feed

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus