Hi Ian, Thanks a ton. It's really a lot clearer now. The name for the belongs_to relationship was given by the AdventAjaxGrid2_create.pl when I created the model. Disregarding the instruction not to modify anything above the md5sum line, I changed the relationship name in People.pm from 'affiliation_id' to 'affiliation'. I could then access the affiliation_id column in the People table without having to mention the relationship name. Nice. But what is the recommended way for getting around the problem of the catalyst helper using the column name for the relationship name ? To what extent can one safely disregard the 'don't modify' instruction?
On Sun, May 3, 2009 at 1:58 AM, Ian Sillitoe <[email protected]> wrote: > This is really a matter for the DBIx::Class mailing list > > But I'm still not clear why I need to use the belongs_to relationship when >> the affiliation_id is directly available in the People table. > > > If you only want to access the affiliation_id column then no, you wouldn't > need to define the belongs_to relationship. However it seems the belongs_to > relationship was declared with the same name as the "affiliation_id" column, > so rather than the accessor returning the column value that you expected, > you got the belongs_to relationship (which happens to have it's own > "affiliation_id" column accessor). > > Have a look at the docs for declaring the belongs_to() relationship and > take note of the difference between the relationship name (e.g. > "affiliation") and the name of the foreign key used to define the > relationship (e.g. "affiliation_id"). > > > http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Relationship.pm#belongs_to > > Also maybe take a closer look at the usage examples in my last post - that > should really explain the same as above. > > Cheers, > -- > Ian Sillitoe > CATH Team -- http://cathdb.info > > > > _______________________________________________ > List: [email protected] > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/[email protected]/ > Dev site: http://dev.catalyst.perl.org/ > >
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
