Rails New: MVC & Routing
Welcome back to the second installment in our series of “Rails new” posts. Last week, our VP of Development, Tim Mecklem demonstrated just how easy it is to get a custom Web application up and running with Rails. We also saw how some key pieces of the Rails ecosystem fit together, such as source code repositories stored on GitHub and community support via the Cincinnati Ruby Brigade website and Discord server.
If you were a bit mystified by some of the Rails “magic” from the first video then you’ve come to the right post. This week we’ll dig a bit deeper to de-mystify what an MVC framework like Rails is and how it turns a browser’s request for a URL into a living-breathing application that responds to its users’ requests for information in an efficient manner. “Models”, “Views” and “Controllers” are useless in isolation. Routing is the glue that brings all the pieces together and orchestrates how MVC components interact.
When you’re ready, head over to the July 2020 CincyRB meeting video and see if things don’t become a bit clearer.
After watching the video you should be able to:
- Use a Rails scaffold generator
- Navigate the structure of a Rails application
- Understand Rails routing and how it wires all the pieces of MVC together
Just as the last video, this video is pretty self-explanatory. Should you find the material challenging, check out Rails Routing from the Outside In on the RailsGuides website. Also like the last video, there was no code pushed to GitHub for this meeting but feel free to explore the source code repositories on CincyRB’s GitHub account if you want to peek ahead to subsequent material. Don’t forget that you can ask questions on the CincyRB Discord server.
Next week we’ll dive into the “M” (for “models”) in “MVC” which is implemented as “ActiveRecord” in Rails.