Skip to content

Instantly share code, notes, and snippets.

@akzhan
Created July 2, 2016 14:39
Show Gist options
  • Save akzhan/42543a2d7d9d838fa421de1a3161f41a to your computer and use it in GitHub Desktop.
Save akzhan/42543a2d7d9d838fa421de1a3161f41a to your computer and use it in GitHub Desktop.
use JSON::XS ();
use DBIx::Class::ResultClass::HashRefInflator;
my $jsoner = JSON::XS->new->utf8(0)->allow_blessed;
sub country {
my $self = shift;
my $c = schema->resultset('Country')->search(undef, {
result_class => 'DBIx::Class::ResultClass::HashRefInflator',
});
return $self->render_json( $jsoner->encode( $c->first ) );
}
@akzhan
Copy link
Author

akzhan commented Jul 2, 2016

Take a note at ->utf8(0) mutator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment