0
Rails3에서 2 개의 모델을 정의하고 항목 및 업로드를 정의했습니다. 항목에 다형성 연관이있는 많은 업로드가 있습니다.accept_nested_attributes_for로 Mongomapper 상위 모델 유효성 검사가 실패합니다.
class Item
include MongoMapper::Document
include MongoMapper::AcceptsNestedAttributes
attr_accessible :uploads_attributes
belongs_to :category
many :uploads,:as => :picture_of
accepts_nested_attributes_for :uploads
key :name, String
key :description, String
validates_presence_of :name
timestamps!
end
class Upload
require 'carrierwave/orm/mongomapper'
include MongoMapper::EmbeddedDocument
attr_accessible :image,:remote_image_url
# belongs to Item, Event
# upload , just for photo
belongs_to :picture_of, :polymorphic => true
key :versions, Array
mount_uploader :image, ImageUploader
timestamps!
# for nested_attributes
def _destroy
end
end
하여 업로드 속성과 항목을 만들려고 할 때 검증의 실패 때문 실패, 아래처럼
정의 보인다. 내 정의에 문제가 있습니까?