Getting started with Ruby on Rails at RailsGirlsBLR 2015

Hi Everyone !! It’s been a long time since i wrote my last blog.
This Blog is about the experience and on how to get started with Ruby on Rails. Rails Girls organized a one day workshop on the basics of Ruby on Rails at ThoughtWorks,Bangalore on 31st January 2015.

When i heard about the event I was a little sad at the first moment because I thought it will be only for girls as it is being organized by Rails Girls but when i went to the registration page I was happy to see that it was open for everyone. So I went ahead and registered for it. So before the event we were supposed to install ruby and rails on our machine (Not compulsory just for the sake of saving time). I installed ruby on rails with the help of the following document. I did the installation using the source file, you can even go for installation using rvm. The document is really useful and provides an easy guide to install Ruby and Rails along with setting up SQL and NodeJS.

The event kick started at 10 am with an introduction of the coaches and the event organizers. All the participants were divided among different teams with at most 6 participants in each team and two to three coaches per team. My team consists of two guys who are working in a start up and my friends Anagha (who helped me a lot during the workshop), Patrick (a student from Coimbatore) and Yashas (a student from Bangalore). We had three cool coaches : Aditi, Mewan and Divya. Then we had a small introduction about all of us and we soon kick started with rails.

So now let’s start with the technical and cool part. 😀
First, Let’s discuss:

  1. What is Ruby ?
    Ruby is a dynamic, reflective, object-oriented, general-purpose programming language.Ruby was influenced by Perl, Smalltalk, Eiffel, Ada, and Lisp. It supports multiple programming paradigms, including functional, object-oriented, and imperative.
  2. What is Rails/Ruby on Rails ?
    Ruby on Rails, or simply Rails, is an open source web application framework written in Ruby. Rails is a full-stack framework that emphasizes the use of well-known software engineering patterns and paradigms, including convention over configuration (CoC), don’t repeat yourself (DRY), and model–view–controller (MVC).

Soon the coaches started the session by briefing us about the MVC architecture. Mewan started by discussing the different parts of the architecture. This architecture is widely used in Web Applications. The Controller section can send the commands to both the model as well as the view. The Model is the part which deals with the updates and handles the database. The View part is the representation to be displayed to the user.

As we gained a slight knowledge of MVC architecture, we then decided to get our hands dirty. 😛
We started by the idea of creating a basic Web App to provide Cab Services. So we created our web app folder using the code :
rails new cab

Inside the cab folder we ran a bundle install to get all the gems and associated files.Then we figured out the file structure with the help of coaches. Here’s a screen shot of our cabs folder. 🙂


It consists of folders like app, bin, config, db etc. The app folder consists of the assets, controllers, models, views folders.

After learning the file structure we headed to the terminal and ran the command :
rails server
It starts our server and we can check if our web app has started by opening the localhost:3000 on a web browser.

Now we need to set up our database for our cabs so we enter the following command :
rails generate migration create_cabs

This creates a migration which we will use afterwards to create the relation in database.
Now when we look into our cab/db/ folder we can see a migrate folder under which is a file created with alpha numeric name ending with create_cabs. This file is automatically generated and inside this file now you need to add the relation and its attributes. The file can be found attached here for reference.
Now we need to make these changes in the database, so we use the comand:
rake db:migrate

Now we can go ahead and use scaffolding to do our most of the stuff using the command (This command is an example for our cab web app) :
rails generate scaffold cab cab_type:string cab_no:string rate:integer insure:boolean

This command will automatically generate the controller and view for us. 🙂
We again run the command:
rake db:migrate

Now we open the terminal and run the server again using the command :
rails server

Now go to localhost:3000/cabs in your browser. You will see a webpage with a heading Listing cabs and the attributes which we specified in the relation. You can even find a New cabs option there to enter data to the relation.

So as you can see it took hardly few commands to set up our web page and to link it our web app with the help of Ruby on Rails. This was just a basic guide for getting started up with Ruby on Rails. It’s a really fun language to learn and is growing in the industry rapidly.

These are some of the links which might be useful for the beginners to get started :

And here is the github repo of the cabs web app that we tried to develop.
I hope the blog was helpful for the beginners to get started with Ruby on Rails. For any other queries, feel free to leave a comment.


About abhijainn27

I am a FOSS enthusiast and a keen learner.
This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to Getting started with Ruby on Rails at RailsGirlsBLR 2015

  1. Pingback: Rails Girls Bangalore 2015 | My pages

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s