Hi Guys,
I am using attatchment_fu to adding images to my rails app, and have
the following
<%= article_image_for(@article) %>
which displays the image for my article.. however i just want a text
link to the image instead of the image itself...
can this be done with a link_to? or an <a [EMAIL PROTECTED] ...??
i know this is probably a simple thing to do!! cheers..!!
Here is my code.................
--------------------------------------------------
articles_helper
def article_image_for(article)
if article.article_image
article_img = article.article_image.public_filename
link_to image_tag(article_img),
article.article_image.public_filename
#else
#image_tag("blank-image.png")
end
end
----------------------------------------------------------------
article_images table
id article_id size width height content_type
filename created_at
1 3 4509 500 400 image/jpg
xrve.jpg 2008-08-27 14:21:15
----------------------------------------------------------------
articles model
class Article < ActiveRecord::Base
has_one :article_image, :dependent => :destroy
has_many :comments
end
-------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---