2012-10-11 23 views
3

我试图把图像,当我在图像点击进入例如在for_rent_index_path(在视图中女巫) 例如我有这样的:Ruby on Rails的,如何使图像标签

`<%= link_to "For rent", forrent_index_path %><br/>` 

和作品,但没有形象。我想删除这个,并把标签图像

我该怎么做?

回答

4

你只需要使用图像标签作为链接中的第一个参数。

<%= link_to (image_tag "image.jpg"), forrent_index_path %><br/> 
3
<%= link_to(image_tag("image.jpg", :alt => "image", :width => 50, :height => 50, :title => "Click here") forrent_index_path) %> 
1

试试这个

link_to image_tag('/images/image.png') + "some text", url_for({:controller => 'controller_name', :action => 'action_name'}), :class => 'some class', :remote => true %>