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

what does match ":controller(/:action(/:id))", :via => :get do?

I was just watching a youtube ruby tutourial and he just typed this match ":controller(/:action(/:id))", :via => :get into routes.rb and didn't really explain anything so just some clarification

1 Answer

David O' Rojo
David O' Rojo
11,051 Points

match helps to constraint multiple multiple verbs to a route at once. At the same time, they seem to be using dynamic segments , so every request that matches :controller/(:action(:/:id)) through the GET method can be routed to where it is specified.

If you post a link to link to the video, others or me may be able to get more insight of it.

The video https://www.youtube.com/watch?v=GY7Ps8fqGdc but thanks for answering. I think I kind of got it.