JRuby on Rails with Nine Lives: Running a JRuby on Rails Application on Tomcat, Page 5
Now, create your scaffold for your Guitar Ruby class that Rails will use to manage your guitars table. Run the following command:
jruby script/generate scaffold Guitar
Click here for a larger image.
Figure 14: Generating the Guitar class scaffold
Testing the Rails Application Using WEBrick
Now that you have everything you need to do CRUD operations on our guitars table, give your app a quick test run using Ruby's WEBrick server. You run the following command to start WEBrick and point your browser to http://localhost:3000/guitars:
jruby script/server
Click here for a larger image.
Figure 15: Running the railswartest app using the WEBrick server
Click here for a larger image.
Figure 16: The railswartest app running on the JRuby WEBrick server
Installing Tomcat
I assume you already have Apache Tomcat installed. If not, you can download it and uncompress it to your desired installation directory. I am using Tomcat version 5.5.17; it is installed to the /opt/tomcat directory.
Creating the WAR File and Deploying It to Tomcat
To create a WAR file of your railstestwar app, run the following command:
jruby -S rake war:standalone:create
Click here for a larger image.
Figure 17: Creating the railswartest WAR
