# Can't upload images - probably cause my routes are messed up

**URL:** <https://www.ruby-forum.com/t/cant-upload-images-probably-cause-my-routes-are-messed-up/192295>\
**Category:** Rails\
**Created:** [July 27, 2010, 9:57pm UTC](https://www.ruby-forum.com/t/cant-upload-images-probably-cause-my-routes-are-messed-up/192295 "2010-07-27T21:57:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenlindner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@jenlindner](https://www.ruby-forum.com/u/jenlindner)\
**Post date:** [July 27, 2010, 9:57pm UTC](https://www.ruby-forum.com/t/cant-upload-images-probably-cause-my-routes-are-messed-up/192295/1 "2010-07-27T21:57:08Z")

</div>

I am attempting to create a model called “encyclopaedia” with multiple  
sections of encyclopaedia articles, each section having an image.

When I attempt to upload an image, I get the error:

Unknown action

No action responded to upload. Actions: create, destroy, edit,  
get\_encyclopaedia, index, is\_admin?, is\_owner\_of, new, show, and update

I have the upload method in my sections controller and I call it from my  
view with:

\<% form\_for [@encyclopaedia,@section], :url =\>{:controller =\> :sections,  
:action =\> :upload },:html =\> { :multipart =\> true, :method =\> ‘put’} do  
|f| %\>

\<%= f.file\_field :image\_file %\>

  

\<%= f.submit ‘Upload’ %\>

  
\<% end %\>

in my routes.rb file, I have set up a nested route to access the upload  
method:

map.resources :encyclopaedias do |encyclopaedias|  
encyclopaedias.resources :sections,  
:member =\> { :upload =\> :put}  
end

and rake routes outputs:

upload\_encyclopaedia\_section PUT  
/encyclopaedias/:encyclopaedia\_id/sections/:id/upload(.:format)  
{:action=\>“upload”, :controller=\>“sections”}

This seems to be what I want, but I’m fairly new to rails so I’m  
probably missing something…

Does anyone know why I can’t use the upload method in my controller?

Thanks,

Jennifer

---

<div class="post-metadata">

**Author:** ![jenlindner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e47c2d/32.png) [@jenlindner](https://www.ruby-forum.com/u/jenlindner)\
**Post date:** [July 27, 2010, 10:55pm UTC](https://www.ruby-forum.com/t/cant-upload-images-probably-cause-my-routes-are-messed-up/192295/2 "2010-07-27T22:55:39Z")

</div>

So, I had an extra end in the method above my update method in the  
controller, lol silly error

Jennifer
