Adding Image icon to a Blog title post

I created a simple blog and I'm using paperclip to be able to add images to a Post. I installed the 'themify-icons-rails' gem and what I want to do is automatically add a picture icon next to the title of a post when the post has a image that's been uploaded, to show that the post has a image. I'm guessing I would need a If statement somewhere but I'm fairly new to rails and I'm not sure where to put it.

<h2 class="ti-gallery"><%= link_to post.title, post %></h2> this adds the "Ti-gallery" icon to every post.

Any Help will be greatly appreciated, Thank you before hand. Oh and one more questions, Is rails Video friendly? i can't seem to find any tutorials on uploading videos to a rails app.

I created a simple blog and I'm using paperclip to be able to add images to a Post. I installed the 'themify-icons-rails' gem and what I want to do is automatically add a picture icon next to the title of a post when the post has a image that's been uploaded, to show that the post has a image. I'm guessing I would need a If statement somewhere but I'm fairly new to rails and I'm not sure where to put it.

<h2 class="ti-gallery"><%= link_to post.title, post %></h2> this adds the "Ti-gallery" icon to every post.

Assuming that what you want to leave out is the class specification and assuming that post.image will be nil if there is no image (replace that with something similar as necessary) <h2 <%= "class=/"ti-gallery/"" if post.image %> >   <%= link_to post.title, post %> </h2>

I have split it onto multiple lines to make it easier to read, that will not affect the displayed page. The result of the code "class=/"ti-gallery/"" if post.image will either be the class= string or nil.

Colin

Thank you, Thank you, Thank you!, removing the nil? actually worked. Question How friendly is rails with videos, I also want to upload videos. but can't seem to find any tutorials on doing that.