I have a nested resourced called attachments:
(routes.rb)
map.resources :content_campaigns do |content_campaigns|
content_campaigns.resources :attachments, :member => { :download
=> :get}
end
But, I can’t seem to generate the new path after I create a new
attachment:
(attachments_controller.rb)
format.xml { head :created, :location =>
attachment_url(@attachment) }
I get this trace:
ActionController::RoutingError (attachment_url failed to generate from
{:action=>“show”, :content_campaign_id=>“7”,
:controller=>“attachments”},
expected: {:action=>“show”, :controller=>“attachments”}, diff:
{:content_campaign_id=>“7”}):
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/routing.rb:1273:in raise_named_route_error' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/routing.rb:1245:in
generate’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/url_rewriter.rb:104:in rewrite_path' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/ action_controller/url_rewriter.rb:69:in
rewrite’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/
action_controller/base.rb:522:in `url_for’