Hi Josh,

> I'm currently using map.namespace to set the name_prefix to  
> "admin/".  Doing this appears to break polymorphic_url (and thus  
> form_for, url_for, etc) as it isn't taking name_prefix into  
> account.  Quick hack would be to allow polymorphic_url to accept a  
> namespace or name_prefix argument.  Does anyone else have any  
> better ideas to make this work?

I'm not sure a namespace or name_prefix argument will work in all
cases... consider that you could have namespaces and resources nested
to any number of levels.

I was thinking that a syntax like the following might work though:

# routes.rb
map.namespace :admin do |a|
   a.resources :workshops do |w|
     w.resources :sessions
   end
end

# views
<%= url_for([:admin, @workshop, @session]) %>
<%= link_to('Session', [:admin, @workshop, @session]) %>
<% form_for([:admin, @workshop, @session] do |f| %>
# ...
<% end %>

The symbol would correspond to the namespace, and could be made to
handle nested namespaces.

-- 

Thanks,

Dan
__________________________________________________________________

Dan Kubb
Autopilot Marketing Inc.

Email: [EMAIL PROTECTED]
Phone: 1 (604) 820-0212
Web:   http://autopilotmarketing.com/
__________________________________________________________________




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to