点击该按钮会在网址中传递button=
:
# example.html.haml
= form_for @contact, html: { method: :get }
= f.text_field :phone
= f.button "Call Me!"
如何阻止Rails传递额外的URL参数?
答案 0 :(得分:2)
将name: nil
添加到按钮:
= form_for @contact, html: { method: :get }
= f.text_field :phone
= f.button "Call Me!", name: nil