Re: Question on the "common way" to code

Jacob Atzen
Sun, 22 Jul 2007 09:24:38 -0000

s.ross wrote:
> (3) Whatever works. Either works fine, both are ugly but necessary.
> Better, in your model do this:
>
> def full_name
>    first_name + last_name
> end

The question was ".." vs. model.method + " " + model.method.
I agree you
should put these kinds of function in the model or in a helper.

>> 3. dynamic links
>> link_to(composer.first_name + " " + composer.last_name
>> and
>> link_to("#{composer.first_name} #{composer.last_name}"

Personally I usually prefer the second alternative as I find it easier
to read. But that''s just a matter of taste.

--
Cheers,
- Jacob Atzen