私は画像を入れようとしていますが、画像をクリックして、たとえば for_rent_index_path (ビューの魔女) に移動すると、次のようになります:
`<%= link_to "For rent", forrent_index_path %><br/>`
動作しますが、画像がありません。これを削除してタグ付きの画像を入れたい
どうすればそれができますか?
私は画像を入れようとしていますが、画像をクリックして、たとえば for_rent_index_path (ビューの魔女) に移動すると、次のようになります:
`<%= link_to "For rent", forrent_index_path %><br/>`
動作しますが、画像がありません。これを削除してタグ付きの画像を入れたい
どうすればそれができますか?
リンク先の最初のパラメーターとしてイメージタグを使用するだけです。
<%= link_to (image_tag "image.jpg"), forrent_index_path %><br/>
<%= link_to(image_tag("image.jpg", :alt => "image", :width => 50, :height => 50, :title => "Click here") forrent_index_path) %>
これを試して
link_to image_tag('/images/image.png') + "some text", url_for({:controller => 'controller_name', :action => 'action_name'}), :class => 'some class', :remote => true %>