Skip to content

Instantly share code, notes, and snippets.

@tubbo
Created January 28, 2011 05:21
Show Gist options
  • Select an option

  • Save tubbo/799869 to your computer and use it in GitHub Desktop.

Select an option

Save tubbo/799869 to your computer and use it in GitHub Desktop.
// Given we have an Active Record class that maps a DB table
var post=new ActiveRecord('posts', {
id: new AR_Integer(),
title: new AR_String(255),
body: new AR_Text()
});
/*
This ActiveRecord object needs to:
- Create a new row in 'posts' when someone calls new Post{ properties-object}); Since the String passed in was called 'posts', ActiveRecord needs to create an object called Post that people can create, so it can add such a row to the DB.
- Create properties for every column in the database.
*/
// when they are set, how would it update the database?
post.id;
post.title;
post.body;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment