コード日進月歩

しんくうの技術的な小話、メモ、つれづれ、など

2018-12-24から1日間の記事一覧

RailsにおいてModelのcreate!はブロックで囲めるし、それで関連レコードの作成ができる

こんな書き方あるんだ的なメモ 環境 $ bin/rails -v Rails 5.2.2 やり方 今回使うモデル # == Schema Information # # Table name: users # # id :bigint(8) not null, primary key # name :string(255) # created_at :datetime not null # updated_at :date…