ruby
1#new.html.erb 2<%= simple_form_for @math do |f| %> 3 <%= f.input :num_1 %> 4 <%= f.input :num_2 %> 5 <%= f.button :submit, "OK!" %> 6<% end %>
ruby
1class CreateScores < ActiveRecord::Migration[5.2] 2 def change 3 create_table :scores do |t| 4 t.integer :num_1 5 t.integer :num_2 6 t.integer :ans 7 8 t.timestamps 9 end 10 end 11end
num_1 と num_2 の積を計算して ans にに保存したいです。
よろしくお願いします。
あなたの回答
tips
プレビュー