Hi there, i am very new to ror and i want to create a page which does the following: The user can register(devise) and can specifiy a page name e.g. jondoe. After this his account is send by email etc. Now I want to generate a page which follows the following route: www.mydomain.com/jondoe What I understood is that the ror standard routing goes /controller/ action but of course I dont have a controller called jondoe. I also want to have the router for creating a user or doing something else via url www.mydomain.com/user/edit I know this questions could be stupid but I didnt found a way to solve this issue. Can somebody give me a hint? Thanks! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 6, 3:53 pm, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi there, > > i am very new to ror and i want to create a page which does the > following: > > The user can register(devise) and can specifiy a page name e.g. > jondoe. After this his account is send by email etc. > > Now I want to generate a page which follows the following route: > > www.mydomain.com/jondoe > > What I understood is that the ror standard routing goes /controller/ > action but of course I dont have a controller called jondoe. > > I also want to have the router for creating a user or doing something > else via urlwww.mydomain.com/user/edit > > I know this questions could be stupid but I didnt found a way to solve > this issue. Can somebody give me a hint? >Two things: You don''t have to stick with the defaults, if you want action/ controller, action/id/controller, randomword/action etc.. then just go ahead. You can also have wildcards in the paths you match, which sounds like what you want The docs for ActionController::Routing (or ActionDispatch::Routing) have plenty of examples. There''s also a guide on routing (http:// guides.rubyonrails.org/routing.html) Fred> Thanks!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Thank you! I will have a look at it. On 6 Jan., 17:59, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 6, 3:53 pm, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi there, > > > i am very new to ror and i want to create a page which does the > > following: > > > The user can register(devise) and can specifiy a page name e.g. > > jondoe. After this his account is send by email etc. > > > Now I want to generate a page which follows the following route: > > >www.mydomain.com/jondoe > > > What I understood is that the ror standard routing goes /controller/ > > action but of course I dont have a controller called jondoe. > > > I also want to have the router for creating a user or doing something > > else via urlwww.mydomain.com/user/edit > > > I know this questions could be stupid but I didnt found a way to solve > > this issue. Can somebody give me a hint? > > Two things: > You don''t have to stick with the defaults, if you want action/ > controller, action/id/controller, randomword/action etc.. then just go > ahead. > You can also have wildcards in the paths you match, which sounds like > what you want > The docs for ActionController::Routing (or ActionDispatch::Routing) > have plenty of examples. There''s also a guide on routing (http:// > guides.rubyonrails.org/routing.html) > > Fred > > > Thanks! > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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 Jan 7, 7:01 am, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you! I will have a look at it. > > On 6 Jan., 17:59, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > On Jan 6, 3:53 pm, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi there, > > > > i am very new to ror and i want to create a page which does the > > > following:When I have a little, but very important advice for you: try to use resources and the REST design.> > > The user can register(devise) and can specifiy a page name e.g. > > > jondoe. After this his account is send by email etc. > > > > Now I want to generate a page which follows the following route: > > > >www.mydomain.com/jondoeThere is a very good recipe for this kind of things: Please check Rails Recipes book [Make Your URLS Meaningful (and Pretty)] Most likely you will need something like this: map.connect '':user'', :controller => ''users'', :action => ''show'', :filter => ''user''> > > What I understood is that the ror standard routing goes /controller/ > > > action but of course I dont have a controller called jondoe. > > > > I also want to have the router for creating a user or doing something > > > else via urlwww.mydomain.com/user/edit > > > > I know this questions could be stupid but I didnt found a way to solve > > > this issue. Can somebody give me a hint? > > > Two things: > > You don''t have to stick with the defaults, if you want action/ > > controller, action/id/controller, randomword/action etc.. then just go > > ahead. > > You can also have wildcards in the paths you match, which sounds like > > what you want > > The docs for ActionController::Routing (or ActionDispatch::Routing) > > have plenty of examples. There''s also a guide on routing (http:// > > guides.rubyonrails.org/routing.html) > > > Fred > > > > Thanks!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
Hi Ivan, I inserted now the above mentioned line but I am getting now the following error: /config/routes.rb:8:in `block in <top (required)>'': undefined local variable or method `map'' for #<ActionDispatch::Routing::Mapper: 0x3eba8b0> (NameError) is map.connect still available in rails3? On 9 Jan., 06:07, ivanpoval <ivanpo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 7, 7:01 am, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Thank you! I will have a look at it. > > > On 6 Jan., 17:59, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > On Jan 6, 3:53 pm, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi there, > > > > > i am very new to ror and i want to create a page which does the > > > > following: > > When I have a little, but very important advice for you: try to use > resources and the REST design. > > > > > The user can register(devise) and can specifiy a page name e.g. > > > > jondoe. After this his account is send by email etc. > > > > > Now I want to generate a page which follows the following route: > > > > >www.mydomain.com/jondoe > > There is a very good recipe for this kind of things: Please check > Rails Recipes book [Make Your URLS Meaningful (and Pretty)] > Most likely you will need something like this: > map.connect '':user'', :controller => ''users'', :action => > ''show'', :filter => ''user'' > > > > > What I understood is that the ror standard routing goes /controller/ > > > > action but of course I dont have a controller called jondoe. > > > > > I also want to have the router for creating a user or doing something > > > > else via urlwww.mydomain.com/user/edit > > > > > I know this questions could be stupid but I didnt found a way to solve > > > > this issue. Can somebody give me a hint? > > > > Two things: > > > You don''t have to stick with the defaults, if you want action/ > > > controller, action/id/controller, randomword/action etc.. then just go > > > ahead. > > > You can also have wildcards in the paths you match, which sounds like > > > what you want > > > The docs for ActionController::Routing (or ActionDispatch::Routing) > > > have plenty of examples. There''s also a guide on routing (http:// > > > guides.rubyonrails.org/routing.html) > > > > Fred > > > > > Thanks!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.
its working now, i did the following: match ''/:page_name'' => ''page#show'' Now my second question is, if I cant find the page_name not in the db how do I route to standard routes resources? On 19 Jan., 19:22, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Ivan, I inserted now the above mentioned line but I am getting now > the following error: > > /config/routes.rb:8:in `block in <top (required)>'': undefined local > variable or method `map'' for #<ActionDispatch::Routing::Mapper: > 0x3eba8b0> (NameError) > > is map.connect still available in rails3? > > On 9 Jan., 06:07, ivanpoval <ivanpo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Jan 7, 7:01 am, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Thank you! I will have a look at it. > > > > On 6 Jan., 17:59, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > On Jan 6, 3:53 pm, Gambo <mark.vanv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Hi there, > > > > > > i am very new to ror and i want to create a page which does the > > > > > following: > > > When I have a little, but very important advice for you: try to use > > resources and the REST design. > > > > > > The user can register(devise) and can specifiy a page name e.g. > > > > > jondoe. After this his account is send by email etc. > > > > > > Now I want to generate a page which follows the following route: > > > > > >www.mydomain.com/jondoe > > > There is a very good recipe for this kind of things: Please check > > Rails Recipes book [Make Your URLS Meaningful (and Pretty)] > > Most likely you will need something like this: > > map.connect '':user'', :controller => ''users'', :action => > > ''show'', :filter => ''user'' > > > > > > What I understood is that the ror standard routing goes /controller/ > > > > > action but of course I dont have a controller called jondoe. > > > > > > I also want to have the router for creating a user or doing something > > > > > else via urlwww.mydomain.com/user/edit > > > > > > I know this questions could be stupid but I didnt found a way to solve > > > > > this issue. Can somebody give me a hint? > > > > > Two things: > > > > You don''t have to stick with the defaults, if you want action/ > > > > controller, action/id/controller, randomword/action etc.. then just go > > > > ahead. > > > > You can also have wildcards in the paths you match, which sounds like > > > > what you want > > > > The docs for ActionController::Routing (or ActionDispatch::Routing) > > > > have plenty of examples. There''s also a guide on routing (http:// > > > > guides.rubyonrails.org/routing.html) > > > > > Fred > > > > > > Thanks!-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.