[Catalyst-commits] r9516 - Catalyst-Controller-DBIC-API/1.001/trunk/lib/Catalyst/Controller/DBIC

lukes at dev.catalyst.perl.org lukes at dev.catalyst.perl.org
Wed Mar 18 12:24:48 GMT 2009


Author: lukes
Date: 2009-03-18 12:24:48 +0000 (Wed, 18 Mar 2009)
New Revision: 9516

Modified:
   Catalyst-Controller-DBIC-API/1.001/trunk/lib/Catalyst/Controller/DBIC/API.pm
Log:
added docs for list_search_exposes

Modified: Catalyst-Controller-DBIC-API/1.001/trunk/lib/Catalyst/Controller/DBIC/API.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.001/trunk/lib/Catalyst/Controller/DBIC/API.pm	2009-03-18 12:18:23 UTC (rev 9515)
+++ Catalyst-Controller-DBIC-API/1.001/trunk/lib/Catalyst/Controller/DBIC/API.pm	2009-03-18 12:24:48 UTC (rev 9516)
@@ -103,6 +103,35 @@
 
  list_search_exposes => [qw/position/, { cd => ['*'] }]
 
+
+You can also use this to allow custom columns should you wish to allow them through in order to be caught by a custom resultset. For example:
+
+  package RestTest::Controller::API::RPC::TrackExposed;
+  
+  ...
+  
+  __PACKAGE__->config
+    ( ...,
+      list_search_exposes => [qw/position title custom_column/],
+      );
+
+and then in your custom resultset:
+
+  package RestTest::Schema::ResultSet::Track;
+  
+  use base 'RestTest::Schema::ResultSet';
+  
+  sub search {
+    my $self = shift;
+    my ($clause, $params) = @_;
+
+    # test custom attrs
+    if (my $pretend = delete $clause->{custom_column}) {
+      $clause->{'cd.year'} = $pretend;
+    }
+    my $rs = $self->SUPER::search(@_);
+  }
+
 =head2 list_count
 
 Arguments to pass to L<DBIx::Class::ResultSet/rows> when performing search for L</list>.




More information about the Catalyst-commits mailing list