As a new web developer starting with Ruby on Rails, there's a dizzying array of choices for the frontend of your site! This is first in a series of posts that attempts to give a lay of the land, with some personal suggestions on where to start. I'll assume you've at least built a simple Rails app before, if not you can't go wrong with the excellent https://www.railstutorial.org/.
Oxford Dictionary 1. COMPUTING - relating to or denoting the part of a computer system or application with which the user interacts directly.
- The backend is like a theatre's backstage, where stagehands arrange and prepare props and actors get changed for the next scene. This is akin to all the logic we have in our Rails controllers, combining data from our models with the views we wrote to be sent to the browser.
There was once a time when web developers would need to write the HTML for every individual page - check the
404.html page in your Rails app for an example. This was fine for early websites, but perhaps impossible for creating the dynamic, interactive websites of today.
In a framework like Rails, you typically wouldn't write the exact HTML for every single page. Rather, there are multiple components involved that Rails combines to generate the resulting HTML. A simplistic illustration:
- there is a pre-compilation step that compiles and optimises our assets
- a Rails controller renders our view and inserts the correct URLs to the compiled assets, then sends that back in a response to the user
We'll dive a little deeper into the pre-compilation step next, talking about the Asset Pipeline and Webpacker.