in Development

Planning To Work With Ruby on Rails? Here’s A Step By Step Beginner’s Guide

1

Many experts believe that Ruby on Rails is the most robust, simple and time-saving development environment.  Therefore, if you are new to the industry, and are planning to start development work, Ruby on Rails could be the right platform to have your first experience with.  It has all those features that are required to develop a robust application without needing a lot of coding.

You will be required to take a note of the fact that this guide is meant for those developers who are just starting up with Ruby on Rails.  If you already have some experience with the framework, there are chances that you might find some of the points to be very basic.  We shall be using Ruby language version 1.8.7, and all the information shall be provided, keeping that version in mind.

In this guide, we will be looking at such facets of Ruby on Rails as its installation procedure, configuration of database and connecting your app with the same, general layout of a Rails application and also some basic principles of MVC and Restful Designs.

DEFINITIONS

The first step in this guide is to understand certain important definitions of those aspects of the development work that are imperative.

Ruby: Ruby is the programming language which is used by Rails.  All rails applications run on this programming language.

Rails: Rails is a web application framework, which is being talked about in this particular post.  Some of the interesting features about the same are the promptness of its development, and use of DRY concept.  DRY stands for ‘Don’t Repeat Yourself’.  Hence, the codes are saved in the system, and there are certain suggestions made to you too in order to considerably reduce your coding time.

MVC Architecture: MVC stands for model, view, controller.  The architecture is very popular for the ease with which it allows keeping the code DRY.  Hence, it saves the developers’ time and efforts, and hence alleviates the time-to-market of the application.

Rails Features: There are certain features which are pre-installed with rails.  You would need an access to all of these, and they include an Action Pack, Action Mailer, Active Resource, Active Support, Active Model, Active Record and Railties.

REST: When you start developing applications with Rails, you will come across a lot of talk about Restful Architecture.  The foundation of that is in REST, which stands for Representational State Transfer.

A NEW RAILS PROJECT

Now that you know about the various aspects of Rails, and the things that you would require to get started; let us focus on the steps to create a new rails project.

1. Installation: The first step in the process is to install Rails.  It is an extremely simple process.  If you use Windows, you can have access to Rails installer.  You have to follow some quick and directed steps to install Rails as well as Ruby on your system.  To ensure that the installation has happened properly, you can run the command ‘$ rails –version’.  If the command is responded with Rail’s version being used (eg. 3.2.1), you can be certain that the installation has been performed properly.

2. Blog Application: The next step is to create a blog application.  The first thing to do here is to open up a terminal.  Then you are required to navigate to the folder where you can create files.  In that folder, run the command ‘$ rails new blog’.  By this, you will be able to create a fresh Rails Application which will be known as Blog.  It will be saved in the ‘Blog’ directory.  Once this directory has been created, you can directly start working in the same.

3. Database: This is another important stage.  You need to, now, configure as well as create a database.  You need to specify your preference of database in the configuration file, i.e. config/database.yml.  The default database with Rails is SQLite3.  All the necessary details for the same are already available, and you can use those.  This built-in support makes it prudent to work with SQLite3.  On the other hand, you can also decide to configure other databases like MYSQL or Postgre SQL.  In that case, you will be required to make necessary changes to the configuration file.  After the configuration, you need to run a rake command to create an empty database.  You can run ‘$ rake dab:create’ to get started with the same.

4. Application Building: Finally, it is time you said “hello” to rails.  When you install Rails, you come across an already available functional rails application.  That can be a good platform to start your development work.  More intricacies about this stage can be discussed at a later stage.  At this moment, it will be good if you could follow all that’s mentioned above, and start up with the initial set-up.

AUTHOR’S BIO:

Jill Elliott, content publisher with eSiteWorld, has been known for her penchant for Rails. She believes that it is one of the most time-saving and contemporary development frameworks. This initial guide covers some of the very basic points which can assist new developers in setting-up their Rails, and starting off basic work into the ROR Web Development process.

Bogdan

Bogdan is the founder of Top Design Magazine. You can find him in Bucharest-Romania so next time you want to drink a beer there and talk about web and stuff, give him a message.