Discussion:
[jifty-devel] Defining a virtual column
Carlos Arenas
2010-02-12 23:34:27 UTC
Permalink
hello again. as promised, i have more questions...

i am creating a User model with first_name and last_name columns. i
would also like to create a virtual full_name column. so far i have:

column full_name =>
is virtual,
;

but how do i define its value as "first_name.' '.last_name"? i
suspect "defer" might be involved, but i could not find any
documentation or example of defer when applied to the same class.

can someone please give me push in the right direction? thanks.

--
ca
Ruslan Zakirov
2010-02-13 00:29:01 UTC
Permalink
Hi,

You just create a method:

sub full_name { $_[0]->first_name .' '. $_[0]->last_name }
hello again.  as promised, i have more questions...
i am creating a User model with first_name and last_name columns.  i
column full_name =>
   is virtual,
;
but how do i define its value as "first_name.' '.last_name"?  i
suspect "defer" might be involved, but i could not find any
documentation or example of defer when applied to the same class.
can someone please give me push in the right direction?  thanks.
--
Best regards, Ruslan.
Loading...