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 A Route to a Delete Action Deleting Pages

Where does the "pages_path"" method come from?

Jay added "pages_path" method for the redirect back to the list of all posts page. Where does that method come from?

Thanks!

2 Answers

Hey Andrew,

'Pages_path' is the path helper method for the 'pages#show' action in the routes.rb file

Path helper methods are just a shortcut instead of typing out a full link path each time you want to create a link.

In the routes.rb file a path helper in this case is added after the 'pages#show' and is written like this:

as: 'pages'

Rails will automatically add the '_path' to this :)

Hope that helps clear it up :)

Thanks! After I did the next lesson I figured out that it was just a shortcut.