Hi, I''m currently playing with routes, and can''t seem to find the solution for this i want to change the link of edit for a person at the moment I have in route map.resources :persons and in the index of person''s view folder i have edit_person_path(person) but it creates the link to /persons/11/edit i would like to change it like delete /persons/11 I tried to do <link_to "edit",person , :method=>:get> but it brings me to the show, which is the problem , I would like in routes to say all :get for this persons goes to edit and not show. thanks -- Posted via http://www.ruby-forum.com/.
Run a rake routes >routes.lst then look at the routes.lst file. This wil show you all the routes that mapping a resource generates for you by default. What you''re trying to do is alter the default behavior of restful routing. Your desired edit route is the default routing for show. If you override that, then you have to provide an alternative for the show method. If this is a pervasive desire that you simply *must* have, then I''d suggest forgoing the restful routes in general, and dropping back to the old routing method. Get rid of the resource mapping, and "roll your own" routes. But the nice thing about restful routes is the notion of programming by convention -- Posted via http://www.ruby-forum.com/.
Hi, I wanted to keep the restful way, but see if was possible to just edit show as I''m not using it for person. but if it is only possible by using the old routing method, then I guess it is not what I want. thank you Ar Chron wrote:> Run a > > rake routes >routes.lst > > then look at the routes.lst file. This wil show you all the routes that > mapping a resource generates for you by default. > > What you''re trying to do is alter the default behavior of restful > routing. Your desired edit route is the default routing for show. If > you override that, then you have to provide an alternative for the show > method. > > If this is a pervasive desire that you simply *must* have, then I''d > suggest forgoing the restful routes in general, and dropping back to the > old routing method. > > Get rid of the resource mapping, and "roll your own" routes. But the > nice thing about restful routes is the notion of programming by > convention-- Posted via http://www.ruby-forum.com/.