2018-11-25から1日間の記事一覧

accepts_nested_attributes_forの使い方

参考 何がしたいか モデルで accepts_nested_attributes_for を宣言 form を作る view でネストするパラメータを作るための form を作成 ストロングパラメータ save ポイント まとめ 参考 http://kzy52.com/entry/2013/07/10/200144 何がしたいか form でネ…

エラーメッセージ

<% if teacher.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(teacher.errors.count, "error") %> prohibited this teacher from being saved:</h2> <ul> <% teacher.errors.full_messages.each do |message| %> <li><%= message %></li> <% end %> </ul> </div> <% end %> 上記はエラーメッセージを表示…