2013-07-06から1日間の記事一覧
◯要件 1つのフォームで2つ以上のモデルを更新したいパターン1 関連づいている場合fields_forを使うのがベスト。 form_for @blog do |f| = f.text_field :title = f.fields_for :author do |af| = af.text_field :name こうすればcontrollerでは@blogをsave…
◯要件 1つのフォームで2つ以上のモデルを更新したいパターン1 関連づいている場合fields_forを使うのがベスト。 form_for @blog do |f| = f.text_field :title = f.fields_for :author do |af| = af.text_field :name こうすればcontrollerでは@blogをsave…