Skip to content

Instantly share code, notes, and snippets.

@ashgti
Created March 26, 2010 16:31

Revisions

  1. ashgti revised this gist Mar 26, 2010. 1 changed file with 11 additions and 4 deletions.
    15 changes: 11 additions & 4 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -17,10 +17,17 @@ class Comment {
    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.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;
    }


  2. ashgti revised this gist Mar 26, 2010. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -17,3 +17,10 @@ class Comment {
    belongs_to('Post');
    }

    my $post = Post.new(title => "hello World", body => "...");
    $post.save;
    $post.comments.new(posted_by => "Me");
    $post.comments.first.save;



  3. ashgti created this gist Mar 26, 2010.
    19 changes: 19 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    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');
    }