| Path: | README |
| Last Update: | Wed Apr 02 13:48:48 -0400 2008 |
The OpenLaszlo Rails plugin makes it easy to use OpenLaszlo client-side applications with Rails. It includes a generator and helper for creating OpenLaszlo applications and displaying them within Rails views.
For example, the following shell command will create a Rails model named Contact, a REST controller named ContactController, an OpenLaszlo application named applet, and a view named contact/applet. At this point the applet will automatically display records that it retrieves, via the controller, from the model.
> ./script/generate applet contact applet
The plugin defines the following generator, that can be used to quickly create an OpenLaszlo stub application and a view that displays it. Use the —help option with a generator for more information.
./script/generate applet # generates an OpenLaszlo source file, and a view to hold it
The plugin defines the following tasks:
rake openlaszlo:build:applets
Recompile any applets in the app/applets directory
rake openlaszlo:clobber:applets
Clean the applets directory
rake openlaszlo:install:javascripts
Copies the OpenLaszlo javascripts to public/javascripts
0: Install OpenLaszlo, Ruby, and Ruby on Rails.
1: Install the ROpenLaszlo gem:
> gem install ropenlaszlo
2: Install this plugin. In your rails application directory:
> ./script/plugin install svn://rubyforge.org/var/svn/laszlo-plugin/tags/openlaszlo
3: Set your OPENLASZLO_HOME environment variable to the directory that contains the OpenLaszlo SDK. If the following prints anything, you‘ve got it right:
> grep Laszlo "$OPENLASZLO_HOME/README.txt"
4: Set your OPENLASZLO_URL environment variable to the web location of the OpenLaszlo server; for example, http://localhost:8080/lps-3.1.1. This step is optional in other platforms (although it makes compilation faster), but is mandatory on Windows.
In your RAILS application directory:
1: Create an applet, and a view that displays it:
> ./script/generate applet contacts applet
2: Compile the applet:
> rake applets
Now launch the server (script/server), and you can view your applet at http:127.0.0.1:3000/contacts/applet.
FlashObject is by Geoff Stearns.