Forum: Ruby on Rails Edge Rails: Nested resources and the new url_for

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9a1b1136b42f179b246b9d3eb66fc996?d=identicon&s=25 sol (Guest)
on 2007-07-25 09:08
(Received via mailing list)
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
57e939ff00f9df2670a09f417c08da5e?d=identicon&s=25 Josh Knowles (Guest)
on 2007-07-26 01:46
(Received via mailing list)
On 7/25/07, sol <ch.blank@gmail.com> 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 Knowles
joshknowles@gmail.com
http://joshknowles.com
This topic is locked and can not be replied to.