# Edge Rails: Nested resources and the new url\_for

**URL:** <https://www.ruby-forum.com/t/edge-rails-nested-resources-and-the-new-url-for/110315>\
**Category:** Rails\
**Created:** [July 25, 2007, 9:08am UTC](https://www.ruby-forum.com/t/edge-rails-nested-resources-and-the-new-url-for/110315 "2007-07-25T09:08:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sol](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@sol](https://www.ruby-forum.com/u/sol)\
**Post date:** [July 25, 2007, 9:08am UTC](https://www.ruby-forum.com/t/edge-rails-nested-resources-and-the-new-url-for/110315/1 "2007-07-25T09:08:12Z")

</div>

Hey,

recently simply\_helpful has been integrated into edge rails, and  
url\_for now supports array for nested resources.

So I can specify this:  
remote\_form\_for([@effort.user,@effort]) for a route like /users/x/  
efforts

however, this looks for “efforts\_url”

there was a patch that also automatically generates name\_prefixes for  
nested  
resources, with the form user\_efforts\_… which is very handy.

now, if I want to use both advantages, I would have to specify two  
paths:

map.resources :users do |users|  
users.resources :efforts, :collection =\> { :subpage  
=\> :get }, :name\_prefix =\> nil  
users.resources :efforts, :collection =\> { :subpage =\> :get }  
end

is there a way to solve this? eg. let url\_for use the name prefix too?

thanks,  
christoph

---

<div class="post-metadata">

**Author:** ![sol](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ebca7d/32.png) [@sol](https://www.ruby-forum.com/u/sol)\
**Post date:** [July 26, 2007, 1:46am UTC](https://www.ruby-forum.com/t/edge-rails-nested-resources-and-the-new-url-for/110315/2 "2007-07-26T01:46:32Z")

</div>

On 7/25/07, sol [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> is there a way to solve this? eg. let url\_for use the name prefix too?

Prepend the symbol of the namespace as the first arg of the array:  
url\_for [:my\_namespace, @parent\_object, @child\_object]

–  
Josh K.  
removed\_email\_address@domain.invalid  
[http://joshknowles.com](http://joshknowles.com)
