Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我正在执行某个new操作,并且想要将一些额外信息传递给该create操作(例如,用户按下给定按钮的次数,:clicks)。
new
create
:clicks
我应该如何去完成任务?
尝试:
<%= hidden_field_tag 'click_count', 0 %> <%= submit_tag "Click me!", :type => 'button', :onclick => '$("#click_count").val(parseInt($("#click_count").val())+1)' %>