ActiveRecord.js: Object Relational Mapping (ORM) for your iPhone Webapps

By
On January 19, 2009

active_record.png

ActiveRecord.js is an open source object relational mapper (ORM) for JavaScript that takes a lot of inspiration from Ruby on Rails’ ActiveRecord database access library. In theory, objects are used to encapsulate database access and add domain logic. In practice, you can do things like this:

var fred = User.create({
username: 'fred',
age: 32
});

fred.username // => 'fred'

fred = User.findByUsername('fred') // => returns the fred object

var users = User.find({ all: true, order: 'id DESC', limit: 10 });

ActiveRecord.js supports a lot of the functionality that you get with Rails’ own ActiveRecord and, as such, brings a lot of power directly into the browser. It supports several environments, such as Google Gears, Chrome, and Adobe AIR, but also browsers that support the HTML5 SQL specification – which includes Webkit and the iPhone’s version of Safari!

For more information, see the official ActiveRecord.js or Aptana’s announcement post (with more links and explanatory text).

Comments are closed.