Running on Rails

Yesterday, we started our journey into the world of Rails. For those unfamiliar, Rails is the most popular and established framework for programming in the Ruby language. It was created in 2003 and released as open source in 2004 as a comprehensive web app framework, which provides all of the necessary implements to follow the MVC program structuring.

Rails was produced to make it easier to start a new program by making certain assumptions around what a developer will need and want when starting up a new app. The framework prioritizes ‘convention over configuration’, meaning it’s structured in a way that works to decrease the number of decisions and hurdles a developer must face when starting up their program.

The Ruby on Rails Doctrine is as follows:

  • Optimize for programmer happiness
  • Convention over Configuration
  • The menu is omakase
  • No one paradigm
  • Exalt beautiful code
  • Provide sharp knives
  • Value integrated systems
  • Progress over stability
  • Push up a big tent

Some of these tenants may sound a little cryptic, so for a richer run-down on each, you can check out the Ruby on Rails site. A major takeaway here though it that — like with Ruby — Rails is enormously focused on programmer happiness and application functionality.

We’ve already played around in the framework making a few different apps to experience the true power of the Rails framework and why it is indeed such a good tool to use for making a project or program operational in a very short amount of time.

As an example, today I made a database complete with views, models, routes, and controllers, in less than 30 minutes. For this, I used scaffolding, which set up all my CRUD routes (a user’s ability to create, read, update, delete) with essentially one command — bin/rails generate scaffold Book title:string author:string description:text url:text — and added a tiny bit of (not so stylish) CSS styling.

A view from my ‘books’ database program

While the site is pretty simple and straightforward, I’m sharing the example to illustrate just how quickly you can get a useful, full-stack, functional site up and running in almost no time at all using the Rails framework. I’m going to try to play around with the styling and some more of the routes for the site tonight (and am also going to try to get functionality up to post a thumbnail image for submitted books). Definitely enjoying my first couple of days of life on the Rails!

Song of the Day:Livewire” by Oh Wonder