# TypeError: no implicit conversion of Symbol into Hash when submitting form to upload files

**URL:** <https://www.ruby-forum.com/t/typeerror-no-implicit-conversion-of-symbol-into-hash-when-submitting-form-to-upload-files/236761>\
**Category:** Rails\
**Created:** [October 1, 2013, 5:22pm UTC](https://www.ruby-forum.com/t/typeerror-no-implicit-conversion-of-symbol-into-hash-when-submitting-form-to-upload-files/236761 "2013-10-01T17:22:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [October 1, 2013, 5:22pm UTC](https://www.ruby-forum.com/t/typeerror-no-implicit-conversion-of-symbol-into-hash-when-submitting-form-to-upload-files/236761/1 "2013-10-01T17:22:46Z")

</div>

I’m currently new to Rails and Ruby and I’m trying to learn from my  
mistakes, this time I’m trying to upload 2 files from a form for later  
processing, however, after I hit the “Submit” button. I keep getting  
this  
error:

TypeError in UploadFilesController#create

app/controllers/upload\_files\_controller.rb:28:in `new' app/controllers/upload_files_controller.rb:28:in`create’

Request

Parameters:

{“utf8”=\>“✓”,  
“authenticity\_token”=\>“2JJGtRXjWCZlPNhQdx6wOW4xvTseiRaXNylnUYvA5v4=”,  
“upload\_files”=\>{“inventory”=\>#\<ActionDispatch::Http::UploadedFile:0x2fd8940  
@original\_filename=“1\_Inventory.xlsx”,  
@content\_type=“application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”,  
@headers=“Content-Disposition: form-data;  
name=“upload\_files[inventory]”;  
filename=“1\_Inventory.xlsx”\r\nContent-Type:  
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\r\n”,  
@tempfile=#Tempfile:C:/Users/V80042~1/AppData/Local/Temp/RackMultipart20130930-9236-qiqijn\>,  
“material\_list”=\>#\<ActionDispatch::Http::UploadedFile:0x2fe3cf8  
@original\_filename=“2\_Material\_List.xlsx”,  
@content\_type=“application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”,  
@headers=“Content-Disposition: form-data;  
name=“upload\_files[material\_list]”;  
filename=“2\_Material\_List.xlsx”\r\nContent-Type:  
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\r\n”,  
@tempfile=#Tempfile:C:/Users/V80042~1/AppData/Local/Temp/RackMultipart20130930-9236-g22588\>},  
“commit”=\>“Upload”}

My upload\_files\_controller:

class UploadFilesController \< ApplicationController  
def new  
@uploadFiles = UploadFiles.newend

def create  
@uploadFiles = UploadFiles.new(params[:upload\_files])end

Models:

Upload\_Files:

class UploadFiles \< ActiveRecord::Base  
attr\_accessible :inventory, :material\_list  
has\_one :inventory  
has\_one :material\_list  
has\_attached\_file :inventory, :material\_list

def new  
{  
“name” =\> read\_attribute(:upload\_file\_name),  
“size” =\> read\_attribute(:upload\_file\_size),  
“url” =\> upload\_file.url(:original),  
“delete\_url” =\> upload\_file\_path(self),  
“delete\_type” =\> “DELETE”  
}  
endend

Inventory:

class Inventory \< ActiveRecord::Base  
belongs\_to :upload\_filesend

Material List:

class MaterialList \< ActiveRecord::Base  
belongs\_to :upload\_filesend

\_form:

\<%= form\_for :upload\_files do |f| %\>

### Upload Inventory
\<%=  
f.file\_field :inventory %\>
### Upload Product List
\<%= f.file\_field  
:material\_list %\>
  
\<%= f.submit “Upload” %\>
\<% end %\>

Could you please tell me what am I doing wrong and how to fix it? Thank  
you  
in advance.

Note: In case you haven’t noticed, I’m using paperclip and rails 3.x.x
