RSS
11 Dec 2007

jRails: jQuery On Rails

Author: ceefour | Filed under: Ajax, Cool, HTML, Plugins, Rails, Ruby, Tips, Tools, Web 2.0

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!

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

  • Armiol

    Does anyone know if it is Rails 2.0 compatible?

  • http://iframe.in/ Jacky Brown

    jQuery on rails is the same slow as in the php?