Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby Web Application demonstrating the use of the InfoVis javascript library to display HR demo schema data
JavaScript Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
public
views
README
oracle_hr_visualization.rb

README

The application was developed using Jit 1.1.3.  Server-side code was written in ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] and utilizes the following gem versions:

-	sinatra (0.9.4)
-	json (1.1.9)
-	activerecord (2.3.4)
-	activerecord-oracle-adapter (1.0.0.9250) 

Ruby OCI8 was used to provide an interface to a local Oracle XE installation on Windows XP.

A single ruby source file named oracle_hr_visualization.rb contains the URL mappings for the application and the "glue code" to get data out of the database and into JSON format.  A directory named "public" contains javascript libraries and a cascading style sheet, and a folder named views contains ERB (Embedded Ruby) templates that are essentially HTML and javascript with some inline ruby code (these are analogous to JSPs in Java or ASPs in .NET).

The code in oracle_hr_visualization.rb is relatively short and straightforward – approximately 150 lines including comments.  The simplicity of the code is due to the included gems which do the bulk of the heavy lifting.  Sinatra is a web micro framework that is essentially a domain specific language (DSL) for creating ruby based web applications.  With Sinatra in use, creating a new page was simple as mapping a URL and providing an accompanying page in the views directory as a page template.  ActiveRecord is used to access a database connection (a more minimal implementation might simply use Oracle OCI8).  The JSON gem provides modifications to the base Hash class that allow it to be outputted to JSON using a single method call. 
Something went wrong with that request. Please try again.