Garry
Garry

Reputation: 1341

'Getting Started with Rails' tutorial section 5.7 - route syntax

It's probably me getting the wrong end of the stick, but here goes..

Following the Ruby on Rails tutorial here http://guides.rubyonrails.org/getting_started.html

(Ruby 2.0.0, Rails 4.0)

All good until I get to this section here:

Section 5.7

If that's a route entry as the text suggests, then it doesn't look like the right syntax to me. I can make it work by changing it to this..

get '/posts/:id(.:format)' => 'post#show'

...haaang on... (penny drops)

Looking at it as I type this, it looks like the tutorial is showing the output of the rake routes command and expecting me to translate it to the valid route entry syntax?

(Given the copy/paste nature of the rest of the tutorial isn't that a little confusing for Ruby/Rails noobs like myself?)

Same question, different answer here Rails getting started 5.7

Upvotes: 1

Views: 280

Answers (1)

Ju Liu
Ju Liu

Reputation: 3999

I guess that the doc needs some updating, since before it tells you to add

resources :posts

to your routes.rb configuration file, which should automatically add all 7 rest routes for you.

The guide tells you that the show action is absent in your controller. I think that the whole sentence should be reworded :)

Upvotes: 0

Related Questions