【進捗報告20200713】

本日の作業

【active_hash】

 

関連付け

class Destination < ApplicationRecord
<追加>
extend ActiveHash::Associations::ActiveRecordExtensions
belongs_to_active_hash :prefecture
<追加/>
belongs_to :user, optional: true
validates :destination_family_name,
省略

 

セレクトボックスの作成

.field
= f.label :都道府県
%span.required 【必須】
%br/
= f.select :prefecture_id,
       Prefecture.all.map { |pre| [pre.name, pre.id] },
        {include_blank: "選択する"}

・選択してない状態がないので{include_blank: "選択する"}を追加

(配列の後ろに書くものだと思い込んでてprefecture.rbに書いたりしてました)

・入力後、記入漏れと出てしまいページ遷移しないので

 registrations_controller.rb

 destination_paramsのprefecture_idをつける

 

完成

f:id:kanecoma:20200714001627p:plainf:id:kanecoma:20200714001623p:plain



昨日まで何時間も悩んでたものがあっさり終わった日だった

明日マージできればマークアップかな