On 6/11/07 12:14 PM, Michael Reece wrote: > is there a better way to get related_count() methods? > > attachments => { > type => 'many to many', > map_class => 'MyDB::RelatedAttachment', > map_from => 'asset', > map_to => 'related', > manager_args => { sort_by => 'related_asset.sort_order' }, > method_types => [ > Rose::DB::Object::Metadata::Relationship::ManyToMany- >> default_auto_method_types(), > 'count' > ], > },
Try: add_methods => [ 'count' ], > is there a compelling reason to not have these _count methods created > for all my *-to-many relationships? I'm trying to balance default functionality and keeping the namespace clean. IME, names that begin with count_ are somewhat common as column names, so the count method is not in the default list to avoid relationship count methods from conflicting with column methods. > subclass Rose::DB::Object::Metadata::Relationship::ManyToMany, > override default_auto_method_types, and then override > relationship_type_classes in my Metadata base class, or is there a > more sensible approach? That'd work fine, or you can override some methods in your custom metadata class and add the count method type to your relationships before the class is initialized. -John ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object