Getting Started With JRuby on Rails for Sun GlassFish Enterprise Server v3 Prelude

Creating and Deploying a Simple Rails Application with Warbler

The procedure for creating a simple Rails application for Warbler, is similar to the procedure described in Creating a Simple Rails Application.

ProcedureCreating a Rails application

  1. Create a new directory under <JRUBY_HOME>/samples directory called rails-warbler.

  2. Go to <JRUBY_HOME>/samples/rails-warbler directory and create a sample application called hello:

    jruby -S rails hello
  3. Edit the enviroment.rb file to indicate that your application does not use a database:

    Open <JRUBY_HOME>/samples/rails-warbler/hello/config/environment.rb in a text editor.

  4. Remove the pound character (#) in front of line 21 to uncomment it so that it reads as follows and save:

    config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
  5. Use Warbler to create a war file in <JRUBY_HOME>/samples/rails-warbler/hello application directory:

    jruby -S warble

    This creates a hello.war file in the directory.

ProcedureDeploying the war file

  1. Go to the application directory <JRUBY_HOME>/samples/rails-warbler/hello.

  2. Deploy the application war file to the Enterprise Server by running the asadmin command:

    <AS_INSTALL>/bin/asadmin deploy hello.war
  3. Run the hello application by using the following URL in your browser:

    http://<hostname>:<port>/hello