An image that is a clickable link?


#1

Hi,

How do I make an image that is a clickable link the rails way? Is
there a view helper for this?

Thanks,
Peter


#2

Hey Peter,

I just learned how to do that! Try this:
http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000334

HTH

Mel


#3

Put an image_tag inside a link_to tag.

e.g. ~ <%= link_to(image_tag(“myimage”), {:controller => “mycontroller”,
:action => “myaction”}) %>


#4

From the API documentation

Combine the link_to and image_tag yourself like:
link_to(image_tag(“rss”, :size => “30x45”, :border => 0),
http://www.example.com”)(or you can go to this link to go directly to
the specific page i referenced
http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M000334

----- Original Message ----
From: Peter M. removed_email_address@domain.invalid
To: removed_email_address@domain.invalid
Sent: Monday, January 23, 2006 3:46:23 PM
Subject: [Rails] an image that is a clickable link?

Hi,

How do I make an image that is a clickable link the rails way? Is
there a view helper for this?

Thanks,
Peter


#5

Thanks all.