Skip to content

Instantly share code, notes, and snippets.

@ashgti
Created March 26, 2010 16:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashgti/345078 to your computer and use it in GitHub Desktop.
Save ashgti/345078 to your computer and use it in GitHub Desktop.
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