I can use ActiveRecord.execute() method!   but why cant use
ActiveRecord.define() ?


On Jan 16, 4:38 am, khakman <[email protected]> wrote:
> Ryan Johnson and Aptana have released a solid beta ofActiveRecord.js,
> an ORM JavaScript library that implementsActiveRecordpattern and
> supporting multiple JavaScript environments including, Google Gears,
> In Memory (if no SQL server is available on the client), and Adobe AIR
> (client-side persistence).  It also works on the server-side with
> SQLite and MySQL databases (via Aptana Jaxer, the open source Ajax
> server that embeds the Mozilla browser engine).  HTML5 support is on
> the roadmap.
>
> http://activerecordjs.org. has the source and docs and some 
> examples.ActiveRecord.js is a single file that has no other library
> dependencies.
>
> When using Gears, this means you can persist JavaScript objects and
> their data using pure JavaScript syntax and the ease of 
> theActiveRecordpattern.  All the underlying SQL commands you'd otherwise
> use through the Gears API are encapsulated byActiveRecordAPIs that
> are more natural feeling to JavaScript's syntax and object concepts --
> and often take far fewer lines of code to implement.  Plus, the skills
> you develop usingActiveRecord.js can be leveraged across the other
> supported JavaScript runtimes as well.
>
> Here's a quick example adapted from Ryan's blog post 
> [http://www.aptana.com/blog/rjohnson/activerecord_js_released_as_beta
> ]:
>
>  - - - - - - - - - - - -
>
>  ActiveRecord.connect(ActiveRecord.Adapters.Local,'my_database');
>   //Automatically Connects to Gears if Gears is present.
>
>    var User =ActiveRecord.define('users',{
>        username: '',
>        email: ''
>    });
>    User.hasMany('articles');
>
>    var ryan = User.create({
>        username: 'ryan',
>        email: '[email protected]'
>    });
>
>    var Article =ActiveRecord.define('articles',{
>        name: '',
>        body: '',
>        user_id: 0
>    });
>    Article.belongsTo('user');
>
>    var a = Article.create({
>        name: 'AnnouncingActiveRecord.js',
>        user_id: ryan.id
>    });
>    a.set('name','AnnouncingActiveRecord.js!!!');
>    a.save();
>
>    a.getUser() == ryan;
>    ryan.getArticleList()[0] == a;
>
>  - - - - - - - - - - - -
>
> The Google Group forActiveRecord.js athttp://groups.google.com/group/activejs/

Reply via email to