Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sudodoki/f20892a89e8fbbd231c3 to your computer and use it in GitHub Desktop.
Save sudodoki/f20892a89e8fbbd231c3 to your computer and use it in GitHub Desktop.
19:42 alexspeller: spenguin: imagine the controller layer as a spiderweb with flies on
19:42 alexspeller: spenguin: controllers are like the webbing and the struggling flies are your data
19:43 spenguin: right
19:43 alexspeller: spenguin: the routing layer is the spider. The spider responds to the weather (i.e. URL changes, user input, websocket events, etc etc) by moving flies around (setting controller content to various data)
19:45 alexspeller: due to convention a lot of this is automatic (hitting /posts/1 will find Post id 1 and set the model property of the PostController to that post for example) but it doesn't have to be automatic
19:45 alexspeller: you can override setupController to set the post model to a different controller or you can override model hook so PostRoute finds a different model or multiple models or no model
19:46 alexspeller: the strands of the web are "needs". They connect controllers together.
19:48 alexspeller: So don't get confused by thinking there should always be a 1:1 relationship between models, controllers and routes. Your controller layer (spiderweb) is your application state and routes (spider) manipulate that state in arbitrary ways depending on your application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment