Hello Friends, I want to configure personalized url for e.g. - http://localhost:3000/xyzhere xyz is a database value. Now for the same i have implemented the following syntax inside my route.rb file map.url ''/:name'', :controller => ''controller_name'', :action => ''action_name'' But now when ever i run my application the action_name.rhtml appears whereever i click. So guys really confused any suggestion from your side? Thanks Abhi --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Abhi, Do you want that off of the root path or something like http://domain.com/people/robbyrussell ? These are generally referred to as permalinks. Robby On Tue, Feb 17, 2009 at 8:14 AM, Abhishek shukla <betterabhi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello Friends, > I want to configure personalized url for e.g. - http://localhost:3000/xyz > here xyz is a database value. Now for the same i have implemented the > following syntax inside my route.rb file > > map.url ''/:name'', :controller => ''controller_name'', :action => ''action_name'' > > But now when ever i run my application the action_name.rhtml appears > whereever i click. > > So guys really confused any suggestion from your side? > > Thanks > Abhi > > > >-- Robby Russell Chief Evangelist, Partner PLANET ARGON, LLC design // development // hosting w/Ruby on Rails http://planetargon.com/ http://robbyonrails.com/ http://twitter.com/planetargon aim: planetargon +1 503 445 2457 +1 877 55 ARGON [toll free] +1 815 642 4068 [fax] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Robby Thanks for reply i want just after the domain name -- http://domain.com/robbyrussell <http://domain.com/people/robbyrussell> instead of http://domain.com/people/robbyrussell And the robbyrussell <http://domain.com/people/robbyrussell> will be a dynamic value.. Though i tried the following code inside the route.rb map.url ''/:name'', :controller => ''controller_name'', :action => ''action_name'' It''s work but for ever page the above mentioned action is getting called :( Thanks Abhishek On Tue, Feb 17, 2009 at 9:49 PM, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org>wrote:> > Abhi, > > Do you want that off of the root path or something like > http://domain.com/people/robbyrussell ? > > These are generally referred to as permalinks. > > Robby > > > On Tue, Feb 17, 2009 at 8:14 AM, Abhishek shukla <betterabhi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > Hello Friends, > > I want to configure personalized url for e.g. - > http://localhost:3000/xyz > > here xyz is a database value. Now for the same i have implemented the > > following syntax inside my route.rb file > > > > map.url ''/:name'', :controller => ''controller_name'', :action => > ''action_name'' > > > > But now when ever i run my application the action_name.rhtml appears > > whereever i click. > > > > So guys really confused any suggestion from your side? > > > > Thanks > > Abhi > > > > > > > > > > > -- > Robby Russell > Chief Evangelist, Partner > > PLANET ARGON, LLC > design // development // hosting w/Ruby on Rails > > http://planetargon.com/ > http://robbyonrails.com/ > http://twitter.com/planetargon > aim: planetargon > > +1 503 445 2457 > +1 877 55 ARGON [toll free] > +1 815 642 4068 [fax] > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Have you placed it at the end of your routes.rb file? It''s easier if you show up some real code. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Tue, Feb 17, 2009 at 1:24 PM, Abhishek shukla <betterabhi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hey Robby > Thanks for reply i want just after the domain name > -- http://domain.com/robbyrussell > > instead of > http://domain.com/people/robbyrussell > > And the robbyrussell will be a dynamic value.. > > Though i tried the following code inside the route.rb > > map.url ''/:name'', :controller => ''controller_name'', :action => ''action_name'' > > It''s work but for ever page the above mentioned action is getting called :( > > Thanks > Abhishek > > On Tue, Feb 17, 2009 at 9:49 PM, Robby Russell <robby-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> > wrote: >> >> Abhi, >> >> Do you want that off of the root path or something like >> http://domain.com/people/robbyrussell ? >> >> These are generally referred to as permalinks. >> >> Robby >> >> >> On Tue, Feb 17, 2009 at 8:14 AM, Abhishek shukla <betterabhi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> wrote: >> > Hello Friends, >> > I want to configure personalized url for e.g. - >> > http://localhost:3000/xyz >> > here xyz is a database value. Now for the same i have implemented the >> > following syntax inside my route.rb file >> > >> > map.url ''/:name'', :controller => ''controller_name'', :action => >> > ''action_name'' >> > >> > But now when ever i run my application the action_name.rhtml appears >> > whereever i click. >> > >> > So guys really confused any suggestion from your side? >> > >> > Thanks >> > Abhi >> > >> > > >> > >> >> >> >> -- >> Robby Russell >> Chief Evangelist, Partner >> >> PLANET ARGON, LLC >> design // development // hosting w/Ruby on Rails >> >> http://planetargon.com/ >> http://robbyonrails.com/ >> http://twitter.com/planetargon >> aim: planetargon >> >> +1 503 445 2457 >> +1 877 55 ARGON [toll free] >> +1 815 642 4068 [fax] >> >> > > > > >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 17, 4:14 pm, Abhishek shukla <bettera...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello Friends, > I want to configure personalized url for e.g. -http://localhost:3000/xyzherexyz is a database value. Now for the > same i have implemented the > following syntax inside my route.rb file > > map.url ''/:name'', :controller => ''controller_name'', :action => ''action_name'' > > But now when ever i run my application the action_name.rhtml appears > whereever i click.That sounds like its working. map.name "/:name", :controller => "people", :action => "show" map.connect ":controller/:action.:format" will see a url like "http://localhost:3000/anything" and match it to the first route. it will do the same for "http://localhost:3000/admin" and hence always try and grab PeopleController#show what you''d need to do is declare any important routes before that eg. map.admin "/admin", :controller => "admin" map.name "/:name", :controller => "people", :action => "show" map.connect ":controller/:action.:format" this will make sure that "http://localhost:3000/admin" goes to the right place. My suggestion is if you''re just starting out in rails, keep it simple. http://localhost:3000/people/Abishek looks just as nice, but is much simpler for a newbie. Enjoy. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Make sure you put this near the bottom of routes.rb. map.person ''/:name'', :controller => ''people'', :action => ''show'' Then in your view... <%= link_to "Person Name", person_path("jimmy") %> I don''t think this is the ideal situation, but it''ll do what you''re looking to have done. Really you should be using a named resource, and set the "to_param" value in your person model to "name". On Feb 17, 10:14 am, Abhishek shukla <bettera...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello Friends, > I want to configure personalized url for e.g. -http://localhost:3000/xyzherexyz is a database value. Now for the > same i have implemented the > following syntax inside my route.rb file > > map.url ''/:name'', :controller => ''controller_name'', :action => ''action_name'' > > But now when ever i run my application the action_name.rhtml appears > whereever i click. > > So guys really confused any suggestion from your side? > > Thanks > Abhi--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hey thanks guys its working i put the line @ the bottom.. Regards Abhishek Shukla On Wed, Feb 18, 2009 at 5:41 PM, Dave S <DaveShenk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Make sure you put this near the bottom of routes.rb. > > map.person ''/:name'', :controller => ''people'', :action => ''show'' > > Then in your view... > > <%= link_to "Person Name", person_path("jimmy") %> > > I don''t think this is the ideal situation, but it''ll do what you''re > looking to have done. Really you should be using a named resource, and > set the "to_param" value in your person model to "name". > > > > On Feb 17, 10:14 am, Abhishek shukla <bettera...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hello Friends, > > I want to configure personalized url for e.g. - > http://localhost:3000/xyzherexyz is a database value. Now for the > > same i have implemented the > > following syntax inside my route.rb file > > > > map.url ''/:name'', :controller => ''controller_name'', :action => > ''action_name'' > > > > But now when ever i run my application the action_name.rhtml appears > > whereever i click. > > > > So guys really confused any suggestion from your side? > > > > Thanks > > Abhi > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---