Close this search box.
Close this search box.

Ruby on Rails Chapter 2: A Demo App

Share This Post

Hopefully you were not holding your breath waiting on me to post the follow up to my last blog about Ruby on Rails.

This chapter runs you through some basic Rails commands to get an upper level view of how the language and extensions work together. You also get introduced to the different states or environments of a RoR (Ruby on Rails) application. With a default setup of a RoR application you have at least 2 states: production and development.

Production – is a fully functional (hopefully thoroughly tested) version of your application.

Development  – is what its name says. Still under development. This could be for your first release or the latest and greatest update to any application.

This is one of the first things I noticed as I was reading through the chapter before jumping into coding. You can see the different environments in the Gemfile in Listing 2.1.

The listing shows that in the production environment we are using:

gem ‘pg’, ‘0.15.1’

While in the development environment we are using:

gem ‘sqlite3’, ‘1.3.8’

What does this mean exactly?

Those are two different database (DB) gems that are available for RoR applications. While we are developing we are using a simpler DB in SQLite. It is easier to install and implement — with the caveat that it is much less powerful than PostgreSQL.

I’m not going into more detail here. The important thing to note is that the environments are different and you want to make sure you are altering the correct environment when you are developing your application.

The next thing I noticed was the tutorial used a Scaffolding to show an upper-level overview of how RoR functions.2 I suggest spending an ample amount of time reviewing Listing 2.3 and the text that immediately before and after it. This section thoroughly explains the MVC process and how to use it in an RoR application.3

This section first introduces you to inheritance in RoR and all of its wonderful powers. The MicroPost data inherits the RESTful actions that are available through ActiveRecord. This allows us to map the different actions, such as create, edit, destroy, update, etc in Lisiting 2.3 with its corresponding URL. Ex.)

Hopefully this chapter went pretty well for you as it is fundamental building blocks of what is coming next.

1. Personally, I would advise making your production and development environments identical to avoid any potential issues that may arise during the process of altering your application into your production environment.

2. Scaffolding is not good for production level code.  It is bloated code that would potentially effect performance in a production environment.

3. I did not have a good understanding of how MVC worked when I first started and it was a significant hindrance to my progress.

More To Explore

Current360 2024 Predictions crystal ball

2024 Predictions

Thanks to everyone who responded to our 2024 Predictions survey last month. While the sample size wasn’t quite the size of a Pew or Nielsen,

Tradition and digital media crown become digital

The King is dead.
Long Live the King.

No we’re not talking about Charles VII or his father Charles VI. Instead, we’re recognizing the passing of the baton after years of shifts from

Contact Us

"*" indicates required fields

I am not a robot
Ed Sharp Current360 headshot

Ed Sharp

Ed brings 15 years of traditional and digital media sales experience to the agency, giving us a perspective most agencies don’t have. When he’s not working or seeking new knowledge, Ed hangs out with his wife, two kids, two dogs, one cat, and a hamster. And yes, the cat and hamster are best friends.

Chaney Given

Chaney is a talented and accomplished designer and illustrator, who has expanded his skill set to include motion graphics and video editing. With nearly a decade of experience, his client work includes Waterstep, Baptist Health, the Archdiocese of Louisville Catholic Schools, First Harrison Bank, and many more