エントリーの編集
エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
strong_parametersには:idも追加しよう。 | 自転車で通勤しましょ♪ブログ
記事へのコメント0件
- 注目コメント
- 新着コメント
このエントリーにコメントしてみましょう。
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
strong_parametersには:idも追加しよう。 | 自転車で通勤しましょ♪ブログ
ちょっとハマってたのでメモ書き。rails4。 UserとAddressテーブルを作っていたとして、以下のような関... ちょっとハマってたのでメモ書き。rails4。 UserとAddressテーブルを作っていたとして、以下のような関係だとする。 class User < ActiveRecord::Base has_one :address, inverse_of: :user accepts_nested_attributes_for :address end class Address < ActiveRecord::Base belongs_to :user, inverse_of: :address validates :pref, presence: true, on: :update validates :city, presence: true, on: :update validates :section, presence: true, on: :update end ユーザー情報を更新

