45. package Mock::Book;
use Any::Moose;
extends 'Mock::AR';
use Carp;
has 'id' => (
is => 'rw',
isa => 'Undef | Int',
);
has 'author_id' => (
is => 'rw',
isa => 'Undef | Int',
);
46. has 'title' => (
is => 'rw',
isa => 'Str',
traits => [qw/Unique/],
);
__PACKAGE__->belongs_to('author');
1;
47. find
my $book = MyApp::Book->find(1);
my $book = MyApp::Book->find({ title => ‘hoge’ });
my $books = MyApp::Book->find_all;
my $latests = MyApp::Book->find_all(
{ author_id => $author_id },
{ order_by => { id => 'desc' } }
);