Skip to content

Instantly share code, notes, and snippets.

@ocharles
Created May 24, 2009 21:41
Show Gist options
  • Save ocharles/117274 to your computer and use it in GitHub Desktop.
Save ocharles/117274 to your computer and use it in GitHub Desktop.
package MusicBrainz::Server::Controller::Artist;
BEGIN
{
use Moose;
extends 'MusicBrainz::Server::Controller';
with 'MusicBrainz::Server::Controller::Annotation';
}
__PACKAGE__->config(
model => 'Artist',
entity_name => 'artist',
);
# ...
# ----------
package MusicBrainz::Server::Controller::Annotation;
use Moose::Role;
sub latest : Chained('entry') PathPart('annotation') CaptureArgs(1)
{
my ($self, $c, $gid) = @_;
my $entity = $c->stash->{$self->{entity_name}};
my $annotation = $c->model($self->{model})->annotation->get_latest($entity->id);
$c->stash(
annotation => $annotation,
);
}
sub view : Chained('latest') PathPart('') { }
no Moose::Role;
1;
# --------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment