S
Stefan Kroes
Hi all,
I'm pretty new to Ruby and RoR but I'm trying to learn for a large
project. I wrote the following method in one of my models but it can't
be the right way to do this because ruby should be able to do it way
more concisely. Can you tell me of a better way?
def name
if !@name
property = content_properties.find_by_key('name')
if property
@name = property.value
else
@name = ""
end
else
@name
end
end
Thx in advance,
with regards,
Stefan Kroes
I'm pretty new to Ruby and RoR but I'm trying to learn for a large
project. I wrote the following method in one of my models but it can't
be the right way to do this because ruby should be able to do it way
more concisely. Can you tell me of a better way?
def name
if !@name
property = content_properties.find_by_key('name')
if property
@name = property.value
else
@name = ""
end
else
@name
end
end
Thx in advance,
with regards,
Stefan Kroes