Hi everbody, I''m new in the forum. I'' studing ruby and rails and I hope learn faster with the help of the forum. Well, my problem is basic. I have made a scaffold to create a new object User. User has name, email and password. I created a new view named "login", but i don''t know how to make the route to this view. I Have the function in the controller too. Cbapp::Application.routes.draw do resources :users root :to => ''users#index'' match ''users/login'' => ''users#login'' end and I got this error: Couldn''t find User with id=login Thanks! -- Posted via http://www.ruby-forum.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-/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 https://groups.google.com/groups/opt_out.
Try this:> Cbapp::Application.routes.draw do > root :to => ''users#index'' > match ''users/login'' => ''users#login'' > resources :users > endEnviado desde mi iPhone El 31/10/2012, a las 15:22, IT Coobo Internal Team <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> escribió:> Hi everbody, > > I''m new in the forum. I'' studing ruby and rails and I hope learn faster > with the help of the forum. > > Well, my problem is basic. I have made a scaffold to create a new object > User. User has name, email and password. > > I created a new view named "login", but i don''t know how to make the > route to this view. I Have the function in the controller too. > > > Cbapp::Application.routes.draw do > resources :users > root :to => ''users#index'' > match ''users/login'' => ''users#login'' > end > > > and I got this error: Couldn''t find User with id=login > > Thanks! > > -- > Posted via http://www.ruby-forum.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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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 https://groups.google.com/groups/opt_out.
On 31 October 2012 14:22, IT Coobo Internal Team <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi everbody, > > I''m new in the forum. I'' studing ruby and rails and I hope learn faster > with the help of the forum.I suggest your best plan might be to work right through a tutorial on rails to help you to understand the basics. railstutorial.org is good and is free to use online. Make sure that any tutorial you use is for Rails 3 and that you use exactly the right version of rails that the tutorial expects. Colin -- 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 https://groups.google.com/groups/opt_out.
WOW! I don''t believe it. I only have to reorder the lines as hazardco said! SOLVED! but i have a question. Why reorder the lines solved my problem? anyway thanks guy. -- Posted via http://www.ruby-forum.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-/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 https://groups.google.com/groups/opt_out.
Il 31/10/12 15:22, IT Coobo Internal Team ha scritto:> Cbapp::Application.routes.draw do > resources :users > root :to => ''users#index'' > match ''users/login'' => ''users#login'' > endrules order in routes.rb is important: users resource ''users/:id'' matches before ''users/login'' so login is the id :) you can invert the order of the rules or, better, use a member: Cbapp::Application.routes.draw do resources :users do member do get ''login'' end end root :to => ''users#index'' end Take a look here: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions -- 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 https://groups.google.com/groups/opt_out.
Sorry, use a collection, not a member: Cbapp::Application.routes.draw do resources :users do collection do get ''login'' end end root :to => ''users#index'' end -- 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 https://groups.google.com/groups/opt_out.
thanks Tommaso and hazardco! :) both ways worked. solved. -- Posted via http://www.ruby-forum.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-/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 https://groups.google.com/groups/opt_out.