【问题标题】:Sending param values through Image_tag通过 Image_tag 发送参数值
【发布时间】:2013-06-20 12:18:05
【问题描述】:

我想通过下面给定的图像标签向控制器发送一个参数。我该怎么做?

<%=link_to image_tag("del.png", :alt=>"Remove"), question, :confirm => t('json_message.are_you_sure'), :method => :delete%>

感谢广告 :)-

【问题讨论】:

    标签: html ruby-on-rails erb params


    【解决方案1】:

    您可以使用显式 question_path(question) 路由,然后添加您想要的任何参数。

    例如

    <%=link_to image_tag("del.png", :alt => "Remove"), question_path(question, :remove => true), :confirm => t('json_message.are_you_sure'), :method => :delete %>
    

    此链接将显示为/questions/1?remove=true

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-21
      • 2018-11-24
      • 1970-01-01
      • 2019-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多