Ruby on Rails Beginner Adventures: Simple Blog Application

13 min readSep 3, 2017

Coding Bootcamp Week 3: ALPHA Camp (Singapore)

Previous: Week 1 And Week 2
This week, we started learning Ruby on Rails!

Mission ahead: Learning Ruby on Rails (RoR).

I was initally unclear about the basic definitions so let define it here.

Ruby is a programming language whereas Rails is a gem, or a Ruby library. Specifically, Rails is a web framework that helps make web applications by providing classes for saving to the database, handling URLs and displaying HTML (along with a webserver, maintenance tasks, a debugging console and much more).

So, Ruby on Rails = using Ruby language on the Rails framework.

The Rails philosophy includes 2 guiding principles:

  • Don’t Repeat Yourself (DRY): By not writing the same information over and over again, code is more maintainable, more extensible, and less buggy.
DRY: Don’t repeat yourself.
  • Convention Over Configuration (COC): Rails has opinions about the best way to do many things in a web application, and defaults to this set of conventions. Hence it has many sensible defaults and this speeds development. e.g. Plural naming for the Controller versus Singular naming for the Model.
Convention over Configuration.

Setup for our first project from the terminal (already installed Ruby and other necessary tools like RVM):

  1. $ rvm gemset create project_name
  2. $ rvm gemset use project_name
  3. $ rvm gemset list
    #to check if project_name is the gemset being used
  4. $ gem install rails
  5. $ gem install bundler
  6. $ rails new project_name
  7. $ cd project_name
  8. Create .ruby-gemset
    #open file and use the name of the project as the name of the gemset
  9. Create .ruby-version
    #open file and specify the verison of Ruby to use and save