Ruby on Rails Chapter 2: A Demo App

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

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

B2B Email Marketing

Successful Email Marketing for B2B

Although email has been around longer than social media, instant messages, and even websites, it’s still one of the most effective, affordable ways to get

Contact Us

  • This field is for validation purposes and should be left unchanged.
Photo of Current360 Associate Creative Director Robert Womack

Rob Womack

If there’s anyone who can honestly say, “Been there, done that,” it’s Rob. After traveling the world for seven years in his 20’s, Rob went to LA and started working in film production. Then it was off to New York, where he learned how to program, which eventually brought him back home to Louisville to build websites. At Current360, Rob heads up our in-house production studio, creating all things digital for our clients — videos, commercials, radio spots, and a lot more. 

When he’s at home, Rob likes to create things like homemade kombucha and music.