actually, it is not a resource route. it is a route that is specifically defined. that is there is not resource "type."
match "/types/:types" => "browse#list", :as => :types It is unresourceful route. On May 23, 4:27 pm, Kendall Gifford <[email protected]> wrote: > On Friday, May 20, 2011 4:48:17 PM UTC-6, tashfeen.ekram wrote: > > > I have the below link I am generating and type.name returns some > > strings with a forward slash ("/"). This of course messes up routing. > > I would like to escape it to %2F however I am unclear on how to do > > that. > > > <%= link_to type.name, types_path(CGI::escape(type.name)) %> > > > If I do the below. it gives a no route error. > > > <%= link_to type.name, types_path(CGI::escapeHTML(type.name)) %> > > > Thanks. > > The #types_path method is an auto-generated "named routes" helper (at least > I'm assuming it is based on its name and how you're using it). If you nave a > resource route such as: "resources :types" in your config/routes.rb then the > #types_path helper doesn't need any arguments and takes you to the index > action on the TypesController. So, if my assumptions are right and the index > action is what you're trying to link to, then the following should be > sufficient: > > <%= link_to type.name, types_path %> > > However, if you're trying to link to a specific instance (which it kind of > looks like you intend to) then you'd instead use: > > <%= link_to type.name, type_path(type) %> > > Anyhow, update us on whether these assumptions are correct or not if you're > still having problems. -- 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 [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-talk?hl=en.

