I know that in general it is a "good idea" to move logic out of
templates and into helpers when possible.
For example, you could create a helper (either in the particular
controller's helper file or in the application's helper file). Your
helper might be called "show_div" and it might accept the thing you
want to display as a parameter.
The helper would then test whether or not the object is empty and
display your output when the object is not empty.
Let me know if that is not enough detail. I can provide a working
In any case, that's what I have been doing in cases like this. There
may be other ways too. I'm looking forward to seeing what others