|
Project Information
Links
|
GWT on RailsGWT on Rails integrates GWT client side compiled JavaScript development with Rails REST web services by providing four things:
Installationscript/plugin install http://gwt-on-rails.googlecode.com/svn/trunk/gwt_on_rails Using the Client Generator and Rake SupportTo build a JavaScript REST client for your app using GWT, do the following:
script/generate gwt_client dashboard /Users/jdoe/java_libs/gwt-mac-1.4.61 rake dashboard:compile rake dashboard:hosted From this point forward, you can click the "Refresh" button in the Hosted Mode browser to recompile updated Java code. The above steps will generate a "gwt" tree under RAILS_ROOT/app that will house all GWT clients for your Rails application. Compiled JavaScript output will appear under public/gwt and follows the Java/GWT convention of requiring a package for each class (i.e. "dashboard" is housed in "dashboard.Dashboard"). Using Migrations to Manage GWT Client Resources/ModelsTo use an ActiveRecord "Project" model on the client side, do the following:
script/generate gwt_resource Project dashboard rake db:migrate The above will produce two classes, Project.java and ProjectBase.java in the "resources" package of your GWT client tree. ProjectBase matches your ActiveRecord model and will be regenerated with each migration. Project extends ProjectBase and can thus be used to hold custom code. StatusThis has been tested with Rails 2.0.1, all of its abstract field types, MySQL, and a Mac with GWT 1.4.61 (a build with a fix for Leopard) and GWT-REST 0.1 (bundled). There may be issues with other configurations, especially on Windows where GWT's compilation scripts may need some tweaks for pure Windows (i.e. no cygwin) environments. |