# Create linked image if user logged in, otherwise just show image

**URL:** <https://www.ruby-forum.com/t/create-linked-image-if-user-logged-in-otherwise-just-show-image/121646>\
**Category:** Rails\
**Created:** [November 29, 2007, 4:58pm UTC](https://www.ruby-forum.com/t/create-linked-image-if-user-logged-in-otherwise-just-show-image/121646 "2007-11-29T16:58:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_Leonhard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac91a4/32.png) [@Simon\_Leonhard](https://www.ruby-forum.com/u/Simon_Leonhard)\
**Post date:** [November 29, 2007, 4:58pm UTC](https://www.ruby-forum.com/t/create-linked-image-if-user-logged-in-otherwise-just-show-image/121646/1 "2007-11-29T16:58:51Z")

</div>

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!
