** Resolved... **
If anyone else comes across a similar issue, I did this to hide the
delete link if no posts exist:
<% if Post.exists?(@posts) %>
<%= image_tag ("delete.png") %>
<%= link_to "Delete post",
{ :controller => "posts", :action => "delete",
:id => @posts },
:confirm => "Really delete this post? You cannot undo
this!" %>
<% end %>
On 6 Dec, 21:13, RubyonRails_newbie <[email protected]>
wrote:
> 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!! :-)
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.