Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Rails Routes and Resources Routes to Create Actions Route to Create Pages

Oğulcan Girginc
Oğulcan Girginc
24,848 Points

Why not post '/pages/new'?

Why the post request's path is '/pages' but not '/pages/new'?

The one that was used:

post '/pages', to: 'pages#create'

Why not this one?

post '/pages/new', to: 'pages#create'

1 Answer

Seth Kroger
Seth Kroger
56,414 Points

Under the REST standard the POST request is for creating a new resource. So, a POST to /pages already means "create a new page" making POST to /pages/new redundant.