Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
Railsでネストした関連先のテーブルもまとめて保存したい時に使うのが accepts_nested_attributes_forです。すごく便利。 Railsのソースコードを見ながら使い方をまとめてみました。 コンソールから色々試してみる 定義する class User < ActiveRecord::Base has_one :profile has_many :academics accepts_nested_attributes_for :profile accepts_nested_attributes_for :academics end profile_attributes= と academics_attributes= メソッドが追加される $ rails c has_one の場合 # 登録時 > params = { user: { name: 'Test', pro
このウェブサイトは販売用です! gachinko.org は、あなたがお探しの情報の全ての最新かつ最適なソースです。一般トピックからここから検索できる内容は、gachinko.orgが全てとなります。あなたがお探しの内容が見つかることを願っています!
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く