Forum: Ruby on Rails error message for empty object

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
bmgz (Guest)
on 2006-03-13 11:17
(Received via mailing list)
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?
Norman T. (Guest)
on 2006-03-13 14:18
(Received via mailing list)
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
bmgz (Guest)
on 2006-03-13 14:57
(Received via mailing list)
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 ;-)
This topic is locked and can not be replied to.