[jifty-devel] refers_to details ?

myshare mraptor at gmail.com
Thu Mar 8 18:10:07 EST 2007


hi,

I was just reading the Jifty::DBI again and remember that i had
problems in the beginning with columns ending in _id, because they
have special meaning.
I want to know do you understand well what is described in the
documentation, so here goes :

column oc_fk  => refers_to App::Model::OtherClass;

means we will have the id (fk to the OtherClass), in oc_fk is stored
integer and when we access this column we will extract integer-number.
Now if we have this :

column oc_fk  => refers_to App::Model::OtherClass by 'other_col';

Instead of getting OtherClass::id we will have OtherClass::other_col into oc_fk
Now if we raname oc_fk to oc_fk_id

 column oc_fk_id  => refers_to App::Model::OtherClass by 'other_col';

When accessing $record->oc_fk_id(), we well get the VALUE of
OtherClass::other_col,
instead of the OtherClass::other_col OBJECT ?!

or I'm totaly wrong !!!


More information about the jifty-devel mailing list