Error message for empty object


#1

I want to have some sort of message to be shown
when I have an empty object.

For example when I click on a properties’ gallery
and their are no photos, I want a simple “gallery is empty”

I have managed to do this in the view by doing a crude
code block:

<% unless @object.empty? %>
(show gallery)
<% else %>
gallery is empty
<% end %>

I am sure rails has a better way to solve this,
can anybody help me?


#2

Am Montag, den 13.03.2006, 11:15 +0200 schrieb bmgz:

(show gallery)
<% else %>
gallery is empty
<% end %>

I am sure rails has a better way to solve this,
can anybody help me?

No, that’s it. Just a simple condition. How would you simplify this?


Norman T.

http://blog.inlet-media.de


#3

Norman T. wrote:

No, that’s it. Just a simple condition. How would you simplify this?

I guess i am just a bit paranoid of doing things the wrong way and
adopting bad habits :wink: