【发布时间】:2015-03-18 18:40:20
【问题描述】:
<%= form_tag('add_person', method: 'get') do %>
<%= label_tag(:name, 'Name') %>
<%= text_field_tag(:name) %>
<%= submit_tag 'Add new person' %>
<% end %>
<%= def add_person
if params[:name] == "John")
enter code here
else
enter code here
end
end %>
如何让提交按钮调用函数add_person?我正在使用 Ruby/Rails
【问题讨论】:
-
为什么不使用默认更新操作?
标签: html ruby-on-rails ruby forms function