On Nov 1, 4:40 pm, Pito Salas <li...@ruby-forum.com> wrote: > I would like to be able to create a call to one of these on the fly when > I only find out the name of the resource at run time. For example I > would like to do this: > > resource_name = "assets" > resource_path(resource_name, method => :new) > > Anyone know the Rails/Rest/Routing incantation for that? Thanks!
I believe you are looking for the "url_for" helper. Probably a number of ways you can use it. This one works, and uses the named "new_asset" route. Just make sure resource_name is singular. url_for(("new_"+resource_name).to_sym) Or if the controllers have the standard REST naming, this should also work: url_for(:controller=>resource_name, :action=>:new) -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.