where to add action when getting started with rails

34 views
Skip to first unread message

Night School

unread,
Jul 23, 2013, 11:47:42 PM7/23/13
to rubyonra...@googlegroups.com
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/.

Dheeraj Kumar

unread,
Jul 24, 2013, 12:18:06 AM7/24/13
to rubyonra...@googlegroups.com
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

--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Night School

unread,
Jul 25, 2013, 1:01:22 AM7/25/13
to rubyonra...@googlegroups.com
Thanks very much. That's definitely helpful.

Anton Sizov

unread,
Jul 25, 2013, 4:04:15 AM7/25/13
to rubyonra...@googlegroups.com
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.

Night School

unread,
Jul 26, 2013, 10:09:56 PM7/26/13
to rubyonra...@googlegroups.com
Thanks Anton! I did see it when I ran 'rake routes' so that is good. I
appreciate the help!
Reply all
Reply to author
Forward
0 new messages