Created
March 26, 2010 16:31
-
-
Save ashgti/345078 to your computer and use it in GitHub Desktop.
This file contains 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
class Post { | |
does Resource; | |
has $id does Property(:type(Serial)); | |
has $title does Property(:type(String)); | |
has Text $body does Property; | |
has_many('Comments'); | |
} | |
class Comment { | |
does Resource; | |
has $id does Property(:type(Serial)); | |
has String $posted_by does Property; | |
belongs_to('Post'); | |
} | |
{ | |
my $post = Post.new(title => "hello World", body => "..."); | |
$post.save; | |
$post.comments.new(posted_by => "Me"); | |
$post.comments.first.save; | |
} | |
{ | |
my $post = Post.get(title => 'hello World'); | |
$post.body = 'something else'; | |
$post.save; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment