Skip to content

Instantly share code, notes, and snippets.

@nantrinh
Last active October 22, 2019 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nantrinh/6b519b7bbad97b8e8bc841aacb7c6cfc to your computer and use it in GitHub Desktop.
Save nantrinh/6b519b7bbad97b8e8bc841aacb7c6cfc to your computer and use it in GitHub Desktop.
Blog

How I Memorized Rails Routes

We are asked to memorize the 7 default routes created when we define a single entry in the routing file, for example resources :posts.

This is how I memorized the 7 routes and the 4 helpers in the Rails guides:

Rails routes and helpers

I used posts as an example of a resource and reorganized the table shown in the guide in a way that makes sense to me.

There are 4 paths, 4 helpers, and 7 routes. I know the verbs (methods) under each path must be unique, i.e., there can't be two GET requests to /posts that route to two different actions. I fill in the verbs first, then their associated actions.

Finally, I write down the order in which the actions appear, by convention, in the controller file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment