Created
January 28, 2011 05:21
-
-
Save tubbo/799869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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