ActiveRecord.js for AIR
Aptana has just released beta version of its ActiveRecord.js which is an ORM JavaScript library that implements ActiveRecord pattern. It also works with AIR and in couple of other environments:
- Google Gears (client-side persistence)
- In Memory (if no SQL server is available on the client)
- Adobe AIR (client-side persistence)
- SQLite and MySQL (via Aptana Jaxer, the open source Ajax server)
- additional environments (like HTML5) expected to come through working with the community on the project
And here is the example:
var User = ActiveRecord.define('users',{ username: '', email: '' }); User.hasMany('articles'); var ryan = User.create({ username: 'ryan', email: 'rjohnson@aptana.com' }); var Article = ActiveRecord.define('articles',{ name: '', body: '', user_id: 0 }); Article.belongsTo('user'); var a = Article.create({ name: 'Announcing ActiveRecord.js', user_id: ryan.id }); a.set('name','Announcing ActiveRecord.js!!!'); a.save(); a.getUser() == ryan; ryan.getArticleList()[0] == a;
You can find more info here: http://www.aptana.com/blog/rjohnson/activerecord_js_released_as_beta
