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
(Getting Started with Rails — Ruby on Rails Guides).
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?
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.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.