Intro

jRails is a drop-in jQuery replacement for Prototype/script.aculo.us on Rails. Using jRails, you can get all of the same default Rails helpers for javascript functionality using the lighter jQuery library.

News

jRails 0.4 : jQuery 1.5!

jQuery-UI has just gotten a major update to version 1.5 which stabilizes most of the controls and incorporates the Enchant effects library. jRails follows suit with a single js file for jquery-ui that includes both the modules and effects. The default jRails installation includes a compressed jquery-ui js file that includes the basic modules and effects supported by Prototype/Scriptaculous. There are no modifications to this file, so if you'd like to generate your own with additional modules or effects, just pop on over to the jQuery UI site and customize your own.

This release of jRails also adds support for jQuery.noConflict(). Just uncomment the line in the init.rb file and set it to whatever you like. Now you can use jRails with other libraries without causing problems.

Features

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

Visual Effects

These are the current effects that are included by default in jRails.

Appear

Fade

Puff

BlindDown

BlindUp

BlindRight

BlindLeft

SwitchOff

SwitchOn

SlideDown

SlideUp

DropIn

DropOut

Shake

Pulsate

Squish

Fold

FoldOut

Grow

Shrink

Highlight

How to use

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/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 %>

Install

To install the jRails plugin:

./script/plugin install http://ennerchi.googlecode.com/svn/trunk/plugins/jrails

Then copy the javascript files in the plugin folder to your javascripts directory.

Changelog

  • : Initial Release
  • : Major Effects Updates
  • : jQuery Enchant
  • : jQuery-ui 1.5 and jQuery.noConflict support

Contact

You can post to the jRails group forum and I'll get back to you as soon as I can

Comments, bug reports and feedback are welcomed. I'm also considering developing a similar library for MooTools so if you are interested, please let me know.