added Config::General examples
[catagits/Catalyst-Model-DBIC-Schema.git] / lib / Catalyst / Model / DBIC / Schema.pm
index 38fc0fd..9c7d840 100644 (file)
@@ -156,7 +156,9 @@ C<Catalyst::Model::> namespace.  This parameter is required.
 =item connect_info
 
 This is an arrayref of connection parameters, which are specific to your
-C<storage_type> (see your storage type documentation for more details).
+C<storage_type> (see your storage type documentation for more details). 
+If you only need one parameter (e.g. the DSN), you can just pass a string 
+instead of an arrayref.
 
 This is not required if C<schema_class> already has connection information
 defined inside itself (which isn't highly recommended, but can be done)
@@ -194,6 +196,28 @@ Examples:
                     }
                   ],
 
+Or using L<Config::General>:
+
+    <Model::FilmDB>
+        schema_class   MyApp::Schema::FilmDB
+        connect_info   dbi:Pg:dbname=mypgdb
+        connect_info   postgres
+        connect_info
+        <connect_info>
+            AutoCommit   0
+            on_connect_do   some SQL statement
+            on_connect_do   another SQL statement
+        </connect_info>
+    </Model::FilmDB>
+
+or
+
+    <Model::FilmDB>
+        schema_class   MyApp::Schema::FilmDB
+        connect_info   dbi:SQLite:dbname=foo.db
+    </Model::FilmDB>
+
+
 =item storage_type
 
 Allows the use of a different C<storage_type> than what is set in your
@@ -289,7 +313,11 @@ sub new {
     $self->schema->storage_type($self->{storage_type})
         if $self->{storage_type};
 
-    $self->schema->connection(@{$self->{connect_info}});
+    $self->schema->connection( 
+        ref $self->{connect_info} eq 'ARRAY' ? 
+        @{$self->{connect_info}} : 
+        $self->{connect_info}
+    );
     
     no strict 'refs';
     foreach my $moniker ($self->schema->sources) {