Changed stored_model and stored_result_source attributes to methods for ACCEPT_CONTEX...
[catagits/Catalyst-Controller-DBIC-API.git] / lib / Catalyst / Controller / DBIC / API / StoredResultSource.pm
index 3fc3cf4..a6c301c 100644 (file)
@@ -1,5 +1,5 @@
 package Catalyst::Controller::DBIC::API::StoredResultSource;
-#ABSTRACT: Provides acessors for static resources
+#ABSTRACT: Provides accessors for static resources
 
 use Moose::Role;
 use MooseX::Types::Moose(':all');
@@ -17,40 +17,34 @@ class is the name of the class that is the model for this controller
 
 has 'class' => ( is => 'ro', isa => Str, writer => '_set_class' );
 
-=attribute_public stored_result_source is: ro, isa: L<Catalyst::Controller::DBIC::API::Types/ResultSource>
+=attribute_public result_class is: ro, isa: Str
 
-This is the result source for the controller
+result_class is the name of the resultset class that is the model for this controller
 
 =cut
 
-has 'stored_result_source' =>
-(
-    is => 'ro',
-    isa => ResultSource,
-    lazy_build => 1,
-);
+has 'result_class' => ( is => 'ro', isa => Str, default => 'DBIx::Class::ResultClass::HashRefInflator' );
 
-=attribute_public stored_model is: ro, isa: L<Catalyst::Controller::DBIC::API::Types/Model>
+=method_public stored_result_source
 
-This is the model for the controller
+This is the result source for the controller
 
 =cut
 
-has 'stored_model' =>
-(
-    is => 'ro',
-    isa => Model,
-    lazy_build => 1,
-);
-
-sub _build_stored_model
-{   
-    return $_[0]->_application->model($_[0]->class);
+sub stored_result_source
+{
+    return shift->stored_model->result_source;
 }
 
-sub _build_stored_result_source
+=method_public stored_model
+
+This is the model for the controller
+
+=cut
+
+sub stored_model
 {
-    return shift->stored_model->result_source();
+    return $_[0]->_application->model($_[0]->class);
 }
 
 =method_public check_has_column
@@ -75,7 +69,7 @@ check_has_relation meticulously delves into the result sources relationships to
 sub check_has_relation
 {
     my ($self, $rel, $other, $nest, $static) = @_;
-    
+
     $nest ||= $self->stored_result_source;
 
     if(HashRef->check($other))
@@ -99,14 +93,14 @@ sub check_has_relation
 
 =method_public check_column_relation
 
-Convenience method to first check if the provided argument is a valid relation (if it is a HashRef) or column. 
+Convenience method to first check if the provided argument is a valid relation (if it is a HashRef) or column.
 
 =cut
 
 sub check_column_relation
 {
     my ($self, $col_rel, $static) = @_;
-    
+
     if(HashRef->check($col_rel))
     {
         try