输入类型=按钮访问link_to

时间:2012-10-23 08:45:05

标签: html ruby-on-rails haml

我有以下haml代码

%input{type: "button", value: "Finish"}= link_to "", stop_time_entry_path(time_entry), remote: true

点击按钮后如何访问stop_time_entries_path(time_entry)?

看起来很简单,但我无法弄清楚

2 个答案:

答案 0 :(得分:1)

= link_to stop_time_entry_path(time_entry), remote: true do
    %input{type: "button", value: "Finish"}

这是解决方案。

答案 1 :(得分:0)

有一个button_to Rails助手。试试:

button_to "Finish", stop_time_entries_path(time_entry), remote: true