Simon Krahnke <overlord / gmx.li> writes:
> Well, helper variables aren't "elegant":
>
> def name
>   @name ||= (content_properties.find_by_key('name') ||
>              Struct.new(:name).new('')).name
> end

That's basically equivalent to:

,----
| def name
|   @name ||= content_properties.find_or_initialize_by_key('name').name.to_s
| end
`----

or even this flame bait:

,----
| def name
|   @name ||= content_properties.find_by_key('name').name rescue ""
| end
`----

Of course, I prefer the former.

-- 
Peter Jones [pjones at domain below]
pmade inc. - http://pmade.com