improve Moose ResultSet example in SchemaProxy
Rafael Kitover [Tue, 12 Jun 2012 16:24:05 +0000 (12:24 -0400)]
The sub BUILDARGS { $_[2] } is essential for everything to work, and
users are likely to not know about it when using the Moose example as
is. It's been added to DBIx::Class documentation as well in master.

lib/Catalyst/TraitFor/Model/DBIC/Schema/SchemaProxy.pm

index bba6279..490671a 100644 (file)
@@ -72,8 +72,16 @@ Or, if you prefer L<Moose>:
     use MooseX::ClassAttribute;
     extends 'DBIx::Class::ResultSet';
 
+    sub BUILDARGS { $_[2] } # important
+
     class_has rs_config_key1 => (is => 'rw', default => 'default_value');
 
+    ...
+
+    __PACKAGE__->meta->make_immutable;
+
+    1;
+
 In your catalyst config, use the generated Model name as the config key, e.g.:
 
     <Model::DB::Users>