[jifty-devel] RFC: extended "refers_to ...Collection by..."

Chia-liang Kao clkao at bestpractical.com
Sat Aug 2 14:13:51 EDT 2008


> From time to time I'm hacking on tisql branch of JDBI and I have a
> question for you. In the following list what does look more natural
> and descriptive? I don't describe what this is as it should be self
> descriptive. Vote for any you think is clearer and better.


The current (verbose) version we have is:

   refers_to Foo::Model::AttrCollection by 'foreign_column_for_foo';

how about making extend that with more constraints like

   refers_to Foo::Model::AttrCollection by 'foreign_column_for_foo',   
tisql matching model => 'User' ?

and of course we can translate to whatever underlying internal tisql  
representation.

> 1)
>
> package TestApp::User;
> ...
> use Jifty::DBI::Record schema {
> ...
>    column attrs =>
>        refers_to TestApp::AttributeCollection
>            by tisql => " .record = __record__.id AND .model = 'User'";
> ...
> };
>
> 2)
>
> package TestApp::User;
> ...
> use Jifty::DBI::Record schema {
> ...
>    column attrs =>
>        refers_to TestApp::AttributeCollection
>            by tisql => "attrs.record = .id AND attrs.model = 'User'";
> ...
> };
>
> 3)
>
> package TestApp::User;
> ...
> use Jifty::DBI::Record schema {
> ...
>    column attrs =>
>        refers_to TestApp::AttributeCollection
>            by tisql => ".attrs.record = .id AND .attrs.model =  
> 'User'";
> ...
> };
>
>
> -- 
> Best regards, Ruslan.
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>



More information about the jifty-devel mailing list