Hi, I am making a survey app. The user takes the survey and I''m saving it fine. But what i want next is to redirect the user to /surveys/1/results after completion. I have tried the following in my routes file: Rails.application.routes.draw do resources :surveys do match ''results'' => ''results#index'' end resources :survey_answers end And in my controller i tried: redirect_to survey_results_path(@survey) but im getting: No route matches {:controller=>"results"} Any help? -- 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.
What''s the structure of your model? survey => answers, or survey => results? Use ''rake routes'' to give you a sense of what route helpers you can use. Yan On Aug 3, 7:28 am, jdkealy <jdke...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I am making a survey app. > > The user takes the survey and I''m saving it fine. > > But what i want next is to redirect the user to /surveys/1/results > after completion. > > I have tried the following in my routes file: > > Rails.application.routes.draw do > resources :surveys do > match ''results'' => ''results#index'' > end > resources :survey_answers > end > > And in my controller i tried: > redirect_to survey_results_path(@survey) > > but im getting: > No route matches {:controller=>"results"} > > Any help?-- 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, > > I am making a survey app. > > The user takes the survey and I''m saving it fine. > > But what i want next is to redirect the user to /surveys/1/results > after completion. > > I have tried the following in my routes file: > > > Rails.application.routes.draw do > resources :surveys do > match ''results'' => ''results#index'' > endresources :surveys do resources :results end> resources :survey_answers > end > > And in my controller i tried: > redirect_to survey_results_path(@survey) > > but im getting: > No route matches {:controller=>"results"} >You need a results controller here.> Any help? > > -- > 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. >-- 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.