Rails 3 - link_to with image_tag + text

后端 未结 4 2040
隐瞒了意图╮
隐瞒了意图╮ 2021-02-04 01:56
<%= link_to ((image_tag \'image.png\'), 
        url_for({:controller => \'controller_name\', :action => \'action_name\'}), 
            :class => \'quick\',         


        
4条回答
  •  轮回少年
    2021-02-04 02:29

    Try this:

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

    The first argument is the text part and with image_tag you create HTML, but you can easily append stuff.

提交回复
热议问题