You gave a little to few information (e.g. what gem do you use to store the images) for an optimal answer. So here is the answer for the given question: Add the following method into your Item
model:
def image
"example_image_#{self.code}.jpg"
end
Please be aware that image_tag()
will always result into an asset pipeline path. Please see http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html#method-i-image_tag