やりたいこと
railsのformを使って選択した日時をDBに保存したいです。
view
1 <%= form_for(@procedure) do |f| %> 2 3 <%= f.label :配達日 %> 4 <%= f.date_select :day, class: 'form-control' %>日</label><br> 5 <%= f.datetime_select :time, class: 'form-control' %>頃</label><br> 6 7 <%= f.label :支払い方法 %> 8 <%= f.radio_button :pay,class: 'form-control' %>代金引換</label> 9 <%= f.radio_button :pay,class: 'form-control' %>クレジットカード</label> 10 11 <%= f.submit 'ご注文内容の確認', class: "btn btn-primary" %> 12 <% end %>
controller
1class ProceduresController < ApplicationController 2 def new 3 @procedure = Procedure.new 4 end 5 6 def create 7 @procedure = Procedure.new 8 if @procedure.save 9 redirect_to procedures_path 10 else 11 render 'new' 12 end 13 end 14end
デバックで確認したところ入力したデータが取得できていませんでした。。
なぜできないのでしょうか。。
ご回答お願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2019/02/24 08:51