What is Rails?

cabbagepatchtapeInternet και Εφαρμογές Web

5 Φεβ 2013 (πριν από 5 χρόνια και 5 μήνες)

140 εμφανίσεις

Sakai on Rails

Integrating Ruby and Sakai

David Adams, Virginia Tech

Topics to cover

Quick introduction to Ruby and Rails

Why consider Rails for Sakai?

How to integrate Ruby and Java

How to integrate Rails and Sakai

Tiny demo if we have time


I’m a sysadmin, not a programmer

I’m new to Sakai

I’ve never written a Sakai tool in Java

This is bleeding edge technology

This presentation is a starting point

What is Ruby?

Programming language

Dynamic, interpreted, strongly

Built on ideas from many other languages:

The good parts of Perl

like OO: everything is an object

A few dashes of Scheme


Really Cool Stuff about Ruby

Concise syntax, easy to read


Redefine classes at runtime

Like Javascript, “a crazed language” per Antranig


Duck typing

If it looks like a duck and quacks like a duck…

(These can be good and bad)

The Ruby Community

“Ruby may not actually be the be
all and end
all of
programming languages. But right now, make no
mistake, it's a white
hot nexus of innovation.”


Tim Bray, Sun Microsystems, co
creator of XML

What is Rails?

Web application framework

Built on Ruby

Unique to Ruby

Strict MVC pattern

More than just a CRUD generator

Really Cool Stuff about Rails

Convention over configuration

Use Ruby for


SQL migrations, schemas

Javascript (RJS)

Templates (Markaby)

URL mapping (Routes)

Maintenance tasks (Rake)

Okay, some stuff has to be in YAML

More Really Cool Stuff about Rails

Integrated testing framework

Integrated data validation

Robust plugin system

Robust AJAX integration

ActiveRecord (ORM)

Discovers the database structure without help

Harnesses Ruby’s metaprogramming abilities

Just as useful outside of web applications

Why use Rails?

Write applications quickly

“Powerful web applications that formerly
might have taken weeks or months

to develop can be produced in a matter of

Tim O’Reilly

Less code, better maintainability

Ruby is fun!

Who cares?

Why should the Sakai community care?

Perfect for ad hoc and internal use tools

Rapid prototyping

with functionality

but Rails is Ruby; Sakai runs on Java…

JRuby 1.0

Released June 10, 2007

“Our main goal for 1.0 has been Ruby

We feel this goal has been

Thomas Enebo

Run Ruby (and thus Rails) in the JVM

In some cases, can be faster than C Ruby


Rails in a Servlet

Goldspike (Rails

Rails plugin

Packs Rails app (and dependencies) in a WAR

Experimental Maven 2 support

Kinda flaky; needs tweaking to work with Sakai


A Sakai Tool in Rails

Take a Goldspike WAR

Tweak the web.xml file

Add the sakai.toolname.xml file

Done! (mostly)

Sakai on Rails plugin:


Generator, templates, library


Create a Rails app that runs as a Sakai tool

I won’t go through the environment setup

It’s painful and error prone

Goldspike requires tweaks to work with Sakai

No time to do anything fancy


Something new to learn

Sakai is built on Java

No way (yet?) to call Ruby classes from
Java directly

ActiveRecord versus Sakai APIs

“Attempts to code directly to Sakai databases will only lead

to heartache and disappointment.”

Mark Norton

Now what?

Sakai on Rails not yet ready for prime time

Study performance impact

Streamline/document environment setup

Goldspike needs to be “fixed”

Provide Ruby
ized access to Sakai APIs

Start building small tools


David Adams, daveadams@vt.edu