Hey there. I''m a complete noob when it comes to Rails, and Ruby for that matter. I''ve been trying to make my way through the Getting Started with Rails page on the RoR Guides site (http://guides.rubyonrails.org/getting_started.html). In section 5.7 of that page it says the following: If you submit the form again now, Rails will complain about not finding the show action. That''s not very useful though, so let''s add the show action before proceeding. post GET /posts/:id(.:format) posts#show The problem I''m having is I don''t know where to put this line of code. Does it go in /config/routes.rb? If so, where? Thanks in advance. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f761ef48b19c27a2e69ef223014dc1f9%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Dheeraj Kumar
2013-Jul-24 04:18 UTC
Re: where to add action when getting started with rails
Rails guides are merely guides to using various features of rails, and not a guide to learning rails from a beginner''s POV. For that, I highly recommend http://ruby.railstutorial.org/ruby-on-rails-tutorial-book, which is a free online book. -- Dheeraj Kumar On Wednesday 24 July 2013 at 9:17 AM, Night School wrote:> Hey there. I''m a complete noob when it comes to Rails, and Ruby for > that matter. I''ve been trying to make my way through the Getting > Started with Rails page on the RoR Guides site > (http://guides.rubyonrails.org/getting_started.html). > > In section 5.7 of that page it says the following: > > If you submit the form again now, Rails will complain about not finding > the show action. That''s not very useful though, so let''s add the show > action before proceeding. > > post GET /posts/:id(.:format) posts#show > > The problem I''m having is I don''t know where to put this line of code. > Does it go in /config/routes.rb? If so, where? > > Thanks in advance. > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/f761ef48b19c27a2e69ef223014dc1f9%40ruby-forum.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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/E5794FF88F4645C8B8E9D86D9F7E6DFE%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Night School
2013-Jul-25 05:01 UTC
Re: where to add action when getting started with rails
Thanks very much. That''s definitely helpful. -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5804f49195e3157b0374bec2ee997c57%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
You can see this line when run ''rake routes''. This line means that your app should have controller post with action show and also view show.html.erb in app/views/posts/. Also you should add ''resources :posts'' line in your routes.rb. Then your became able to process HTTP GET request at /posts/:id It was the good suggestion to learn online book, as you will understand how all components works. On Wednesday, July 24, 2013 6:47:42 AM UTC+3, Ruby-Forum.com User wrote:> > Hey there. I''m a complete noob when it comes to Rails, and Ruby for > that matter. I''ve been trying to make my way through the Getting > Started with Rails page on the RoR Guides site > (http://guides.rubyonrails.org/getting_started.html). > > In section 5.7 of that page it says the following: > > If you submit the form again now, Rails will complain about not finding > the show action. That''s not very useful though, so let''s add the show > action before proceeding. > > post GET /posts/:id(.:format) posts#show > > The problem I''m having is I don''t know where to put this line of code. > Does it go in /config/routes.rb? If so, where? > > Thanks in advance. > > -- > 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/e884c19c-52a6-4525-b9c4-c4a06108edfa%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Night School
2013-Jul-27 02:09 UTC
Re: where to add action when getting started with rails
Thanks Anton! I did see it when I ran ''rake routes'' so that is good. I appreciate the help! -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/c307a8e0985222f4fa2b66bbf16dde2f%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.