Rails 3 - 如何在image_tag上应用link_to:remote =>真属性

时间:2011-08-05 08:15:35

标签: ruby-on-rails-3 image view link-to

我正在努力解决有关图像的正确设置参数的问题,即链接。混凝土,

这有效

<%= link_to (image_tag 'img name', 
            :class => 'css'),
        ({controller, action, parameter})%>

这已经不起作用了

<%= link_to (image_tag 'img name', 
            :class => 'css'),
        ({controller, action, parameter},
        {:remote => true})
%>

愿你认为这是一个非常低的问题,但我试图解决它超过半小时但仍然没有...所以我会感谢每一个帮助。

1 个答案:

答案 0 :(得分:1)

你可以试试这个。 (未自我测试)

<%= link_to(image_tag('img name', :class => 'css'), url_for(:controller => 'controller_name', :action => 'action_name'), :remote => true) %>