# Paperclip attachment to AWS - ActiveRecord::AssociationTypeMismatch Going Nuts!

**URL:** <https://www.ruby-forum.com/t/paperclip-attachment-to-aws-activerecord-associationtypemismatch-going-nuts/175199>\
**Category:** Rails\
**Created:** [September 9, 2009, 5:10pm UTC](https://www.ruby-forum.com/t/paperclip-attachment-to-aws-activerecord-associationtypemismatch-going-nuts/175199 "2009-09-09T17:10:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasongarber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/977dab/32.png) [@jasongarber](https://www.ruby-forum.com/u/jasongarber)\
**Post date:** [September 9, 2009, 5:10pm UTC](https://www.ruby-forum.com/t/paperclip-attachment-to-aws-activerecord-associationtypemismatch-going-nuts/175199/1 "2009-09-09T17:10:55Z")

</div>

Hi,  
I have been trying to do this for a few days now and cannot figure it  
out. I  
would be very grateful is anyone can help me

I am trying to upload an attachment to AWS, S3 using paperclip,  
however every time I keep getting this error:

ActiveRecord::AssociationTypeMismatch in  
ProjectController#create\_notice

Graphic(#37649720) expected, got Tempfile(#27280470)

RAILS\_ROOT: C:/devlopment\_tools/projects/codex1/active/bugtrigger  
Application Trace | Framework Trace | Full Trace

c:/devlopment\_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active\_record/associations/association\_proxy.rb:263:in  
`raise_on_type_mismatch' c:/devlopment_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/associations/has_one_association.rb:52:in`replace’  
c:/devlopment\_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active\_record/associations.rb:1246:in  
`graphic=' c:/devlopment_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:2740:in`send’  
c:/devlopment\_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active\_record/base.rb:2740:in  
`attributes=' c:/devlopment_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:2736:in`each’  
c:/devlopment\_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active\_record/base.rb:2736:in  
`attributes=' c:/devlopment_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:2434:in`initialize’  
c:/devlopment\_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active\_record/base.rb:721:in  
`new' c:/devlopment_tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/base.rb:721:in`create’  
C:/devlopment\_tools/projects/codex1/active/bugtrigger/app/controllers/project\_controller.rb:128:in  
`create\_notice’

The code is:

–Notice Model  
class Notice \< ActiveRecord::Base  
has\_many :graphics  
end

–Project Controller  
def create\_notice  
@notice = Notice.create(params[:notice])  
end

–Form  
\<%= form.file\_field(:graphic) %\>

–Graphic  
class Graphic \< ActiveRecord::Base  
belongs\_to :notice  
attr\_accessor :notice\_id  
has\_attached\_file :graphic,  
:storage =\> :s3,  
:s3\_credentials =\> RAILS\_ROOT + “/config/s3.yml”,  
:path =\> “:attachment/:id/:style.:extension”,  
:bucket =\> “attachements”  
end

Thanks!  
-J
