# How to prevent image\_tag helper throwing exception if the ur

**URL:** <https://www.ruby-forum.com/t/how-to-prevent-image-tag-helper-throwing-exception-if-the-ur/48850>\
**Category:** Rails\
**Created:** [November 25, 2005, 4:55pm UTC](https://www.ruby-forum.com/t/how-to-prevent-image-tag-helper-throwing-exception-if-the-ur/48850 "2005-11-25T16:55:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![krisleech](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/59ef9b/32.png) [@krisleech](https://www.ruby-forum.com/u/krisleech)\
**Post date:** [November 25, 2005, 4:55pm UTC](https://www.ruby-forum.com/t/how-to-prevent-image-tag-helper-throwing-exception-if-the-ur/48850/1 "2005-11-25T16:55:17Z")

</div>

If I store the path/filename of an image in the database how do I  
prevent “image\_tag” helper from throwing an exception if a filename/path  
has not been set?

\<%= image\_tag @product.image %\>  
or  
\<%= image\_tag url\_for\_file\_column(“product”, “image”) %\>

Many thanks, K.
