Im trying to show images in my restful application and have finally
found what appears to be the source of the problem.
When i have the products resource nested in categories as showen below
in the first routes file i can see the categories index (/categories).
When i add the images to the products resource map as shown in routes 2
i get the error:
image_url failed to generate from {:controller=>"images",
:action=>"show", :category_id=>"rails"}
It appears that the image_tag is being confused for an image_url ???
Has anyone come across this or have the acts_as_attachment plugin
working in their application.
1. routes.rb (working version1) ========================#eg
categories/1/products
map.resources :categories do |categories|
categories.resources :products
end
map.connect '':controller/service.wsdl'', :action =>
''wsdl''
map.connect '':controller/:action/:id''
2. routes.rb (not working version2)============================#eg
categories/1/products/1/images
map.resources :categories do |categories|
categories.resources :products do |products|
products.resources :images
end
end
map.connect '':controller/service.wsdl'', :action =>
''wsdl''
map.connect '':controller/:action/:id''
view/index=============================<%= image_tag
''rails'' %>
error =================================ActionController::RoutingError in
Categories#index
Showing app/views/categories/index.rhtml where line #20 raised:
image_url failed to generate from {:controller=>"images",
:action=>"show", :category_id=>"rails"}, expected:
{:controller=>"images", :action=>"show"}, diff:
{:category_id=>"rails"}
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---