huard.elise-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Aug-01 12:08 UTC
Re: problem with resources map
You''re using the REST routes. ''artists/1/edit'' is the expected result for this. If you want the default routes, you could just erase map.resources :artists and then the routing of artists/edit/1 will fall back onto the default route, if this is still at the bottom of your routes.rb: map.connect '':controller/:action/:id'' this way ''artists/edit/1'' will work. HTH, Elise Muhammad Arslan Ali wrote:> I am facing problem with resource map > > > > I have controller of artst > > > > class ArtistController < ApplicationController > > > > in routes I have map.resources :artist > > > > and in view > > > > <% for i in @artist %> > > <tr> > > <td><%= i.id %></td> > > <td><%= i.name %></td> > > <td><%> i.created_at.strftime("%Y-%m-%d")%></td> > > <td><%> i.updated_at.strftime("%Y-%m-%d") %></td> > > <td><%= link_to ''Edit'', > edit_artist_path(i) %></td> > > > > </tr> > > <% end %> > > > > edit_artist_path(i) produces link as artists/1/edit > > > > and I want link as artists/edit/1 > > > > How can I do that ? > > > > > > > Internal Virus Database is out-of-date. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.19.21/1263 - Release Date: 2/6/2008 > 8:14 PM--~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
That doesn''t follow the rails way of doing things. You will find your life a lot easier if you "go with the flow" in regards to rails traditions. To get that url you could just stop using map.resources and specify <%= link_to ''Edit'', { :controller > "artists", :action => "edit", :id => i.id } %> instead. --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I am facing problem with resource map I have controller of artst class ArtistController < ApplicationController in routes I have map.resources :artist and in view <% for i in @artist %> <tr> <td><%= i.id %></td> <td><%= i.name %></td> <td><%i.created_at.strftime("%Y-%m-%d")%></td> <td><%i.updated_at.strftime("%Y-%m-%d") %></td> <td><%= link_to ''Edit'', edit_artist_path(i) %></td> </tr> <% end %> edit_artist_path(i) produces link as artists/1/edit and I want link as artists/edit/1 How can I do that ? Internal Virus Database is out-of-date. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.21/1263 - Release Date: 2/6/2008 8:14 PM --~--~---------~--~----~------------~-------~--~----~ 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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---