My journey into Rails

Tags: ruby-on-rails

This is my first experience with Rails, and for the longest time, I've been avoiding learning it since the idea of having to use the terminal is something I'm unfamiliar with. Ruby itself as a language is way different compared to the C-style languages (C#, Java, etc.). They're almost on the opposite ends of the syntax spectrum. I also quickly discovered that majority of Rail developers are either using Mac or Linux with the minority being Windows users. Although Windows is supported, there's a bit of a hassle running it there according to the articles that I've read. I might go back and run it inside Windows again later since I have NetBeans already installed (a free IDE). So I finally forced myself to learn it and set up the environment the "proper way", which is through the Mac OSX.

The main reason why I wanted to learn Rails is perhaps to satisfy my inner curiosity on what the buzz on this web technology is about. Second is to challenge and force myself in a new territory that I've never been before. Knowing C#, PHP, Javascript, and VB-- I felt like I need to learn another language to see programming in a whole new light or perspective. Third, is to increase the extent of my knowledge regarding different programming languages. The day I stop learning another language or web technology, is the day that I have lost my passion towards web development. My goal since the past few years has been to learn a new language every year and I've committed myself to that. Mastery of each of these languages however is a different story since that requires a huge amount of persistence and pure dedication to each individual language.

All things aside, I'd like to start my journey with Rails by writing a post about setting up the environment for the first time.

Installation order (with exception of a few)  and the steps I took to get Ruby on Rails properly running on Mac OSX. Rails 3 requires Ruby version 1.8.7.:

  1. GIT installation (http://git-scm.com/). GIT is a version control utility.
  2. RVM (Ruby Version Manager). (http://beginrescueend.com/rvm/install/) Since the RVM install requires you to get from a GitHub repository, the RVM files can be downloaded in conjunction with GIT. Installing RVM was the part that I ran trouble with so after running the install, a few steps will need to be performed as well so reading the installation guide thoroughly (which I carelessly bypassed) is the key. After installing RVM, everything else including Rails installation will run through it so everything should be pain-free from here on (at least for me anyways).
  3. Install Ruby through RVM. The instruction is referred to in the RVM install page.
  4. Install GemSets. This is required to avoid conflict between Rails 2 and 3 if you're running them both on the same machine. It wouldn't be a bad idea to do this step just to avoid any troubles. In this step also, I set 1.9.2 as my default GemSet using RVM. $ rvm --default use 1.9.2@rails3 (or whatever you named your set to be).
  5. Install RubyGems. Ruby Gems is a package manager for Ruby projects. -- $ ruby setup.rb.
  6. Install Rails. This part uses the RubyGems. -- $ gem install rails --version 3.0.1. To verify -- $ rails -v.
  7. The final step is to create a working directory where the Rail projects will reside in. $ mkdir rails_proj. $ cd rails_proj. $ rails new myapp (this last step adds all the files that's required for a Rails site.
  8. Run the local web server. $ rails server. The default port is running through http://localhost:3000 which then opens up the page shown below.

 

At this point, after a somewhat painful start, the installation process was a good learning start. I learned a few things from my mistake and hopefully won't repeat them again next time.

blog comments powered by Disqus