2012-08-07 16 views
0

我想顯示鏈接到打開一個新的窗口(_target)一個形象的文字,但我不知道的Rails這樣做的3路。我所有的搜索剛剛產生使圖像的鏈接(即鏈接(IMAGE_TAG ....)),但是這不是我想做的事情。的Rails 3:鏈接到圖片在新窗口

什麼我希望做的是顯示文本鏈接「點擊這裏看一個例子」在我的資產/圖像文件夾中的圖像「example.gif」。

我想:

<%= link_to "Click here to see an example", image_tag("example.gif"), :target => "_blank" %>

,但沒有奏效。謝謝!

回答

1

像這樣:

<%= link_to "Click here to see an example", image_path("example.gif"), :target => "_blank" %>