[jifty-devel] refers_to and select field

Jesse Vincent jesse at bestpractical.com
Wed Apr 18 15:25:17 EDT 2007


IN SUK JOUNG wrote:
> Hi,
> Some of my model have 'refers_to' columns. I wanted to add some pairs 
> of 'display' and 'value' to 'valid_values' of the column in addition 
> to the 'Collection' class. So, I overrode arguments sub.
>

Rather than playing with arguments, you _should_ be able to define a sub 
_brief_description in the record class you're referring to that returns 
the name of the method that will give the record's display name. (It 
defaults to "name")

-jesse

> sub arguments {
>     my $self = shift;
>     my $args = $self->SUPER::arguments(@_);
>     unshift @{ $args->{thecolumn}{valid_values} }, { display => 
> 'display name', value => 'value' };
>     return $args;
> }
>
> This works but in the select field, I see many redundant 'display 
> name'. I guess this is not the right approach for it. How do I add 
> extra values in the field?
>
> -- 
> Best,
> In-Suk Joung
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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