2009/12/6 RubyonRails_newbie <[email protected]>: > ** 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!" %> >
Could you not just test @posts directly, presumably it will be nil or empty or something, or am I missing something? I am a bit confused as I would expect a variable called @posts to be an array of Post objects but since you are using :id => posts that suggests it is just one. Colin -- 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.

