1

Rails 3.2.3 で初心者が直面する一般的な問題に直面しています。エラーが発生しています

保護された属性を一括割り当てできません: user_impl、util_location

class User < ActiveRecord::Base

  has_one :user_impl, :dependent => :destroy
  has_one :util_location, :as => :locatable, :dependent => :destroy

  attr_accessible ..., :user_impl_attributes, :util_location_attributes

私も accept_nested_attributes_for :user_impl, :util_location をコードに追加しようとしましたが、それも機能せず、まったく異なるエラーが発生しました。

4

1 に答える 1

1

基本的な構造は次のとおりです。

class User < ActiveRecord::Base
    attr_accessible :user_impl_attributes

    has_one :user_impl, :dependent => :destroy
    accepts_nested_attributes_for :user_impl
于 2012-05-18T15:22:40.670 に答える