[Catalyst-commits] r14409 - in
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk:
lib/CatalystX/CRUD/ModelAdapter t/lib/MyApp/Controller
t/lib/MyApp/Controller/REST t/lib/MyApp/Model
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Tue Dec 4 04:57:55 GMT 2012
Author: karpet
Date: 2012-12-04 04:57:55 +0000 (Tue, 04 Dec 2012)
New Revision: 14409
Added:
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Controller/REST/
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Controller/REST/CRUD.pm
Modified:
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Model/Main.pm
Log:
RT #81079, fix order_by to work with SQL::Abstract
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2012-12-03 15:18:47 UTC (rev 14408)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/lib/CatalystX/CRUD/ModelAdapter/DBIC.pm 2012-12-04 04:57:55 UTC (rev 14409)
@@ -228,7 +228,7 @@
my $self = shift;
my $controller = shift;
my $c = shift;
- my $field_names
+ my $field_names
= shift
|| $c->req->params->{'cxc-query-fields'}
|| $self->_get_field_names( $controller, $c );
@@ -272,9 +272,9 @@
}
}
}
- push @order_by, join( ' ', @$clause );
+ push @order_by, { '-' . lc( $clause->[1] ) => $clause->[0] };
}
- $opts{order_by} = join( ', ', @order_by );
+ $opts{order_by} = \@order_by;
}
#dump \%opts;
Added: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Controller/REST/CRUD.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Controller/REST/CRUD.pm (rev 0)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Controller/REST/CRUD.pm 2012-12-04 04:57:55 UTC (rev 14409)
@@ -0,0 +1,29 @@
+package MyApp::Controller::REST::CRUD;
+use Moose;
+use namespace::autoclean;
+
+# we might not have this module installed
+BEGIN {
+ eval {
+ extends 'CatalystX::CRUD::Controller::REST';
+ __PACKAGE__->config(
+ model_name => 'Main',
+ model_adapter => 'MyModelAdapter',
+ model_meta => {
+ dbic_schema => 'Track',
+ resultset_opts => {
+ join => { track_cds => 'cd' },
+ prefetch => { track_cds => 'cd' }
+ }
+ },
+ primary_key => 'trackid',
+ page_size => 50,
+ default => 'application/json',
+ );
+ };
+ if ($@) {
+ warn "CatalystX::CRUD::Controller::REST not available";
+ }
+}
+
+1;
Modified: CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Model/Main.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Model/Main.pm 2012-12-03 15:18:47 UTC (rev 14408)
+++ CatalystX-CRUD/CatalystX-CRUD-ModelAdapter-DBIC/trunk/t/lib/MyApp/Model/Main.pm 2012-12-04 04:57:55 UTC (rev 14409)
@@ -3,8 +3,10 @@
__PACKAGE__->config(
schema_class => 'MyDB::Main',
- connect_info =>
- [ 'dbi:SQLite:' . MyApp->path_to() . '/../../example.db' ],
+ connect_info => [
+ 'dbi:SQLite:' . MyApp->path_to() . '/../../example.db',
+ quote_names => 1, # RT 81079
+ ],
);
More information about the Catalyst-commits
mailing list