Whilst looping though an array of model objects in my view I want to be
able to show or hide a div that contains the message "Your list is
<% if items.empty?>
#the following is not the correct way
Why would you do this with JS?? Just put the message here. Then
users with or without JS enabled (including spiders and web service
clients) will get the intended view.
<% else >
Thank you all for your input. Thank you hassan for answering some of my
doubts abou this methodology. Basically this is the result of my lack of
The rows in this table represent tasks in a todolist. Theres a delete
option for each task via ajax and the deleted row is taken out via
$().remove_html calls. when all the rows are taken out though i need to
show that message. This is true in reverse. When there are initially no
tasks this message wiill be shown, when a user adds via ajax a task, the
row is inserted via .insert_html. Hence the message needs to be hidden.
I thought it best to do it via a .hide or .show call.
Sorry this is a very quick explanation as my girlfriend is currently
screaming at me that i spend too much time on the pc and i fear for my
If anyone has a design pattern \ best practice about how to handle
tables and messages indicating there are no records plus ajax calls.
please tell. ill be back tomorow