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)' %>