Starting off with Ruby on Rails

The best programmers never quite were pushed into the career. It’s usually the passion and inclination to create your own platform on the internet that makes the start to this incredible journey. Among the most popular languages popular with programmers today is Ruby on Rails. A compact, elegant and a very fun way to create web applications, Ruby on Rails is simple enough to use. Written in the Ruby language, the application designing framework is intended to make job easier for programmers and web developers. It allows writing fewer lines of codes to accomplish more than any other language would be able to.

The logic of Ruby on Rails brings forth a ‘best way’ to do things and encourage designs. Someone who has discovered the potential of Rails will love the tremendous increase in productivity and create a happy experience for both the programmer and the end user of applications.

The Ruby on Rails philosophy is based on two important elements:

1 – Don’t repeat yourself

DRY of ‘don’t repeat yourself’ explains that every piece of information must follow an unambiguous, authoritative and single representation within the system. Not having to write the same things over and over again coding gets more extensible, less buggy and more maintainable.

2 – Convention over configuration

Ruby on Rails offers several different ways to reach the same goals. All its defaults are set to this convention and programmers will not have to attend endless number of configuration files.

Installing your first ‘Rails’ framework

The first of the steps on your Ruby on Rails journey is installing the application framework. Open the command line prompt on your system (“Open Terminal App” for MAC OS users and “Run” for Windows users) and type ‘cmd.exe’. It is necessary that you verify the latest version of Ruby on Rails installed in your system. Also note that any commands that are prefaced by the $ sign must be executed in the program line.

Alternatively, MAC users can use the Tokaido tool to run Rails and Windows users can seek help of the Rails Installer.

Creating a blog application

Ruby on Rails offers several scripts called ‘generators’ that have been designed to make life easier for a developer. It creates everything necessary to begin with a Rails project. One of such tools is the ‘new application generator’ that offers the foundation of your first application without having to write codes. To be able to use this generator, users need to open a ‘terminal’ and navigate to the directory where you will be able to create files. The next step would be to type: ‘$ rails new blog’.

This command will open up a Rails application referred to as ‘Blog’ and subsequently install ‘gem directories’ mentioned in ‘Gemfile’ via the ‘bundle install’. Next step would be switching to its folder $ cd blog.

Hello Rails! You will have a functional application ready. All you need is to access the web server for your development machine. This could be run using the blog directory ‘bin/rails server.

Need Help? Chat with us