Ruby is a very powerful server side language which is commonly compared to PHP as its rival. Ruby is combined with the framework Rails which makes it more powerful programming language and they called it Ruby on Rails.

Now let me give a little hint on how to operate with ruby on rails. This is really for total beginners.

This is how to make a simple application in ruby on rails.  Ruby on Rails use active record which let you connect to your database easily. In this tutorial I will assume that you installed Ruby on Rails Properly in your computer.

Let say we are about to create a Phone Directory. Where in you need their names contact number. Take note Ruby on Rails has its own convention or rules of giving names which is very important if you want your life to be easier.

Step 1.

You need to open your command prompt and go to the directory where you want to create your Ruby on Rails Application.

The code must be rails new name_of_applicationin rails 3 and above.

 

You are now done in creating the application; all you have to do is to add more to make it useful. We need to create a phonebook right. Like any other application we need first to create database, table and fields. Rails already provide databases for you. But by default we they will make you use development database. Since we already have our database we are now on creating tables and fields for our application.  For us to do that, we will be using Scaffold.

This will create tables and fields for us with a corresponding view and controller.

What is view? And what is controller? We will discuss it later.

Run rake db:migate in you cmd in your application directory.

Step 2.

Now we’re than with scaffolding, we are now sure that we already have tables and fields and also controllers and view for our application.

Let us now take a look at it. But first we must run the server webrick. To run the server we must type this code in the command prompt.

Rails server

Then we type this on our browser. Localhost:3000/phone_books to see if it works.

Then finally you have your Phonebook application.

This is your index and when you click the new  Phone Book

You can now add members into your Phonebook List.

Share on Google+Tweet about this on TwitterShare on FacebookShare on TumblrShare on StumbleUponPin on PinterestShare on LinkedInDigg thisShare on RedditEmail this to someone