Hi all, I have an application which has a number of users, each with their own usernames. I am able to setup URLrouting where I can do something like http://myapp.com/charlie63 and that to call a chosen controller, action and passing charlie63 as the id. So that''s fine. This is probably a stupid question, but to prevent problems, do I simply have to have a list of unavailable usernames and not allow people to create accounts with those as usernames? In other words, if I have a controller named, checkout, I need to not allow anyone to create a user name checkout, because when she tried to access her account through her URL http://myapp.com/checkout it will actually go to controller: checkout and action: index? If this is so, do I just need to manually maintain a list of invalid user names and check against those? Or can I call something in Rails to help me to look for existing controllers? Although, I guess I have to be careful because someone may create an account, use that for a while, and later on I may come along and create a controller with the same username. Any help in getting something like this going, pointers, would be greatly appreciated. Cheers, Diego --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
OK, think I''ve got it. I just need to place the routing rules for the username before the standard controller/action/id one which is there by default with a Rails app. So, even if I have a username with the same name as a controller, it will be found if it exists. Otherwise the controller''s routing rule will be evaluated. On Feb 21, 3:50 pm, "Diego" <dbar...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I have an application which has a number of users, each with their own > usernames. I am able to setup URLrouting where I can do something like > > http://myapp.com/charlie63 > > and that to call a chosen controller, action and passing charlie63 as > the id. So that''s fine. > > This is probably a stupid question, but to prevent problems, do I > simply have to have a list of unavailable usernames and not allow > people to create accounts with those as usernames? In other words, if > I have a controller named, checkout, I need to not allow anyone to > create a user name checkout, because when she tried to access her > account through her URLhttp://myapp.com/checkoutit will actually go > to controller: checkout and action: index? > > If this is so, do I just need to manually maintain a list of invalid > user names and check against those? Or can I call something in Rails > to help me to look for existing controllers? Although, I guess I have > to be careful because someone may create an account, use that for a > while, and later on I may come along and create a controller with the > same username. > > Any help in getting something like this going, pointers, would be > greatly appreciated. > > Cheers, > Diego--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Diego wrote:> OK, think I''ve got it. I just need to place the routing rules for the > username before the standard controller/action/id one which is there > by default with a Rails app. So, even if I have a username with the > same name as a controller, it will be found if it exists. Otherwise > the controller''s routing rule will be evaluated. >You can take it a step further and use our resource hacks plugin for Rails. :-) One of our developers recently blogged about it. * http://blog.imperialdune.com/2007/2/13/pretty-urls-with-restful-rails Cheers, -Robby -- Robby Russell http://www.planetargon.com/ http://www.robbyonrails.com/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks Robby, I''ll check it out. On Feb 21, 5:29 pm, "Robby Russell" <r...-/Lcn8Y7Ot69QmPsQ1CNsNQ@public.gmane.org> wrote:> Diego wrote: > > OK, think I''ve got it. I just need to place the routing rules for the > > username before the standard controller/action/id one which is there > > by default with a Rails app. So, even if I have a username with the > > same name as a controller, it will be found if it exists. Otherwise > > the controller''s routing rule will be evaluated. > > You can take it a step further and use our resource hacks plugin for > Rails. :-) > > One of our developers recently blogged about it. > > *http://blog.imperialdune.com/2007/2/13/pretty-urls-with-restful-rails > > Cheers, > > -Robby > > -- > Robby Russellhttp://www.planetargon.com/http://www.robbyonrails.com/--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---