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 trialBenjamin Aragon
4,221 PointsHow does this application function with no routes defined in the routes.rb file? Aren't routes necessary?
The routes file is empty. Seems like the whole application wouldn't work without any routes defined.
4 Answers
Maciej Czuchnowski
36,441 PointsYes, resources gives you all the basic routes used for most applications. GET is used for specific or custom ones.
Maciej Czuchnowski
36,441 PointsI downloaded the code from this stage and it has all the routes:
resources :statuses
Benjamin Aragon
4,221 PointsShouldn't routes be defined like so: get 'beans/new' => 'beans#new'
What does resources :statuses do? It summarizes all Gets, Posts, Deletes, etc. into one line?
Kevin Mulhern
20,374 Pointsresources :statuses create all 7 of the crud routes
index
show
new
create
edit
update
delete
Just think of it as a short cut to create the routes to the above controller actions. It's really helpful because you should be using the REST routes with your models anyway, and do it cuts down on the code you have to write in your routes file.