来自Paperclip :: Attachment instance_write方法的ActiveRecord :: AssociationTypeMismatch

时间:2012-01-30 01:50:29

标签: ruby-on-rails paperclip

我有一个回形针处理器,可以从上传的文件中提取信息。此信息需要上传到表格中。

为了将此自定义信息从回形针处理器传回模型,我执行以下操作

@attachment.instance_write("custom_data",custom_object)

显然这不起作用,我得到ActiveRecord :: AssociationTypeMismatch 相关的跟踪在

之下

activerecord(3.0.6)lib / active_record / associations / association_proxy.rb:264:in raise_on_type_mismatch' activerecord (3.0.6) lib/active_record/associations/association_collection.rb:354:in block in replace' activerecord(3.0.6)lib / active_record / associations / association_collection.rb:354:in each' activerecord (3.0.6) lib/active_record/associations/association_collection.rb:354:in replace' activerecord(3.0.6)lib / active_record / associations.rb:1515:in block in collection_accessor_methods' paperclip (2.3.11) lib/paperclip/attachment.rb:279:in instance_write' lib / paperclip / mypaperclip_processor.rb:16:在'make'

0 个答案:

没有答案