Simon Leonhard
2007-Nov-29 15:58 UTC
Create linked image if user logged in, otherwise just show image
Hey everyone.
RoR beginner here, so be gentle please. I''m stuck at a probably silly
problem and would appreciate any help I can get.
I''m trying to create a linked image to an RSS feed if the user is
logged in; if the user is not logged in, it should just show the image
without the link.
I read through the framework docs and figured
<%= link_to_unless (session[''user''].nil? ,
image_tag("/images/help/
16px-Feed-icon.png", :size => "16x16", :border => 0),
"/index/feed")
%>
would do the trick, but that only displays the image no matter if I am
logged in or not.
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---