Skip to content

Instantly share code, notes, and snippets.

@chrisa
Created May 6, 2009 17:16
Show Gist options
  • Save chrisa/107612 to your computer and use it in GitHub Desktop.
Save chrisa/107612 to your computer and use it in GitHub Desktop.
sub enterprises : PathPart('enterprises') Chained('/') ActionClass('REST') { }
sub enterprises_GET {
my ( $self, $c ) = @_;
my @ents_rs = $c->model('ProfileDB::Enterprise')->all();
my @enterprises = map { { uri => $c->uri_for($c->controller->action_for('enterprise'), $_->id)->as_string,
id => $_->id,
name => $_->name } } @ents_rs;
$self->status_ok(
$c,
entity => {
enterprises => \@enterprises,
},
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment