Added many-to-many add_to_*() example to stress that it returns the related row and...
Norbert Buchmuller [Wed, 2 Sep 2009 02:42:25 +0000 (04:42 +0200)]
lib/DBIx/Class/Manual/Cookbook.pod

index 5a9e75d..e168c36 100644 (file)
@@ -1113,6 +1113,16 @@ This is straightforward using L<ManyToMany|DBIx::Class::Relationship/many_to_man
   $rs = $user->addresses(); # get all addresses for a user
   $rs = $address->users(); # get all users for an address
 
+  my $address = $user->add_to_addresses(    # returns a My::Address instance,
+                                            # NOT a My::UserAddress instance!
+    {
+      country => 'United Kingdom',
+      area_code => 'XYZ',
+      town => 'London',
+      street => 'Sesame',
+    }
+  );
+
 =head2 Relationships across DB schemas
 
 Mapping relationships across L<DB schemas|DBIx::Class::Manual::Glossary/DB schema>