[Catalyst] Jason Kohles' tutorial on ExtJs editable data gridsandCatalyst

jagdish eashwar jagdish.eashwar at gmail.com
Sun May 3 02:23:30 GMT 2009


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 <ian at sillit.com> 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" colu=
mn,
> 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#bel=
ongs_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: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090503/e4e8b=
280/attachment.htm


More information about the Catalyst mailing list