InventoryItem が入れ子になった属性を受け入れるのに問題がありますが、これは奇妙です。
スクリプト/コンソールで、次のことを行いました。
>> InventoryItem.create!(:name => 'what', :image_attributes => [ {:image => File.open("/home/davidc/Desktop/letterbx.jpg", "r") }])
ActiveRecord::UnknownAttributeError: unknown attribute: image_attributes
モデルですでに accept_nested_attributes を実行しているときに、不明な属性エラーが発生する理由がわかりません。
Rails v2.3.5 を使用しています。
在庫品目モデル
class InventoryItem < ActiveRecord::Base
uuid_it
belongs_to :user
has_many :orders
has_many :images, :validate => true
accepts_nested_attributes_for :images
end
画像
class Image < ActiveRecord::Base
belongs_to :inventory_item
has_attached_file :image, :style => { :medium => "300x300>", :thumb => "100x100>" }
end