Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby Rails链接\u无法获得要显示的确认对话框_Ruby_Ruby On Rails 3 - Fatal编程技术网

Ruby Rails链接\u无法获得要显示的确认对话框

Ruby Rails链接\u无法获得要显示的确认对话框,ruby,ruby-on-rails-3,Ruby,Ruby On Rails 3,我试图让链接_能够创建一个包含选项和html选项的链接。我需要能够添加,所以我使用do的方法 我的问题是:我如何让它和确认一起工作。在编写时,它会在url后面追加confirm。我想把它作为一个html选项传递进来,这样它就会弹出对话框 你知道我需要做什么才能让它表现得像那样吗 <li> <%= link_to :controller => "services", :action => "delete_results", :build => @id, :s

我试图让链接_能够创建一个包含选项和html选项的链接。我需要能够添加,所以我使用do的方法

我的问题是:我如何让它和确认一起工作。在编写时,它会在url后面追加confirm。我想把它作为一个html选项传递进来,这样它就会弹出对话框

你知道我需要做什么才能让它表现得像那样吗

<li>
  <%= link_to :controller => "services", :action => "delete_results", :build => @id, :suite => @cookie_value, :confirm => "Are you sure?" do %>
  <i class="icon-trash"></i>
    Delete Results
  <% end %>
</li>
  • “服务”、:操作=>“删除结果”、:生成=>@id、:套件=>@cookie\u值、:确认=>“确定吗?”是否%> 删除结果

  • 谢谢

    url\u选项和html\u选项是链接的独立属性。您需要告诉ruby它们是列表中的不同参数

    链接到({:controller=>“services”,:action=>“delete_results”,:build=>@id,:suite=>@cookie\u value},{:confirm=>“确定吗?”})


    在{}中包装第二个散列是可选的,但是简化了阅读

    太棒了,谢谢。。我发誓我试过了,但每次都有语法错误。但是这个很好用!!