Hi everyone,
I have an account page in which users can update their status. Posts are limited to the most recent update, so it all looks nice and current. The user can also delete a status update one at a time).
I'm looking to try and add a feature that hides the "Delete Posts" link, if no posts currently exist. And then once a post(s) exist, the delete link is then displayed again.
I had this, but it doesn't seem to work:
<% if Post.exists? %>
No posts yet? Add one now! (This will be shown to anyone who views your profile!)
<% else %>
<%= image_tag ("delete.png") %>
<%= link_to "Delete post?", { :controller => "posts", :action => "delete", :id => @posts }, :confirm => "Really delete this post? You cannot undo this!" %>
<% end %>
Any ideas how to do this? I've tried a few combinations, but can't get to the solution. Will keep trying!!