Skip to content

Commit

Permalink
use search_rs rather than force scalar context. fix month endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
bricas committed Nov 14, 2011
1 parent c32fd16 commit 80dfdb2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/SixteenColors/API/Controller/Artist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sub base : Chained('/') PathPrefix CaptureArgs(0) { }

sub list : Chained('base') PathPart('') Args(0) {
my ( $self, $c ) = @_;
$self->status_ok( $c, entity => scalar $c->model( 'DB::Artist' )->search( {}, { order_by => 'name' } ) );
$self->status_ok( $c, entity => $c->model( 'DB::Artist' )->search_rs( {}, { order_by => 'name' } ) );
}

sub instance : Chained('base') PathPart('') CaptureArgs(1) {
Expand Down
2 changes: 1 addition & 1 deletion lib/SixteenColors/API/Controller/Group.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sub base : Chained('/') PathPrefix CaptureArgs(0) { }

sub list : Chained('base') PathPart('') Args(0) {
my ( $self, $c ) = @_;
$self->status_ok( $c, entity => scalar $c->model( 'DB::Group' )->search( {}, { order_by => 'name' } ) );
$self->status_ok( $c, entity => $c->model( 'DB::Group' )->search_rs( {}, { order_by => 'name' } ) );
}

sub instance : Chained('base') PathPart('') CaptureArgs(1) {
Expand Down
2 changes: 1 addition & 1 deletion lib/SixteenColors/API/Controller/Pack.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sub base : Chained('/') PathPrefix CaptureArgs(0) { }

sub list : Chained('base') PathPart('') Args(0) {
my ( $self, $c ) = @_;
$self->status_ok( $c, entity => scalar $c->model( 'DB::Pack' )->search( {} ) );
$self->status_ok( $c, entity => $c->model( 'DB::Pack' ) );
}

sub instance : Chained('base') PathPart('') CaptureArgs(1) {
Expand Down
8 changes: 5 additions & 3 deletions lib/SixteenColors/API/Controller/Year.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ sub instance : Chained('base') PathPart('') CaptureArgs(1) {

sub view : Chained('instance') PathPart('') Args(0) {
my ( $self, $c ) = @_;
$self->status_ok( $c, entity => scalar $c->stash->{ year }->packs );
$self->status_ok( $c, entity => $c->stash->{ year }->packs_rs );
}

sub month : Chained('instance') PathPart('') Args(1) {
my( $self, $c, $arg ) = @_;

my $packs = $c->model( 'DB::Pack' )->search( { year => $c->stash->{ year }, month => $arg } );
my $packs = $c->model( 'DB::Pack' )->search(
{ year => $c->request->captures->[ 0 ], month => $arg }
);

$self->status_ok( $c, entity => scalar $packs );
$self->status_ok( $c, entity => $packs );
}

1;
Expand Down

0 comments on commit 80dfdb2

Please sign in to comment.