Jennifer Lee
2010-Jul-27 19:57 UTC
Can''t upload images - probably cause my routes are messed up
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| %>
<p><%= f.file_field :image_file %></p>
<p><%= f.submit ''Upload'' %></p>
<% 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
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Jennifer Lee
2010-Jul-27 20:55 UTC
Re: Can''t upload images - probably cause my routes are messed up
So, I had an extra end in the method above my update method in the controller, lol silly error Jennifer -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.