#163 √ resolved
BJ Clark

Nesting a resource under multiple other resources creates unexpected routes.

Reported by BJ Clark | February 25th, 2008 @ 12:05 AM | in 0.9

Nesting a resource under multiple other resources only creates the appropriate named route for the last declaration in the file. This creates unexpected routes.

Example:

http://pastie.caboo.se/156666

Creates these routes:

http://pastie.caboo.se/156668

a call such as url(new_ad) generates a route such as:

/users//ads/new

and a calls such as url(new_ad, :user_id => @current_user.id) generates a route such as:

/users/:id/ads/new

I would think the best way to correct this is for nested resources to create named routes such as "users_new_ad". The other option would be to check the params passed so that url(ad, :category_id => 1, :ad_id => 1) generates:

/categories/:id/ad/1

and url(ad, :user_id => 1, :ad_id => 1) would generate:

/users/1/ad/1

I'm posting this here because I didn't know if anyone was working on this and if no one is, what the general consensus is on the best way to implement it.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tags