Re: How to delete nested resource?

szimek
Fri, 21 Mar 2008 11:02:08 -0000

On Mar 21, 11:22 am, Thorsten Mueller <rails-mailing-l...@andreas-
s.net> wrote:
> not 100% sure, but:
> admin_news_item_asset_path(@news, @news.asset)
>
> should be something like:
> admin_news_item_asset_path(@news, :asset_id => @news.asset)
>
> since rails can guess the param name (:id) only for those
> parts of the path, that are declared in the routes, all
> others must be named in hash fashion
> --
> Posted viahttp://www.ruby-forum.com/.

Thanks.

It works, but I still think that rails should automatically figure out
ID of the second parameter passed.

If I run "rake routes", I can see
"admin_news_item_asset_path" listed
there together with DELETE method... The generated url is "/admin/news/
23/asset?id=35", but it should be enough for rails to figure out ID of
the asset even with url like this "/admin/news/23/asset".
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com