This Tutorial is basically designed to provide you the basic introductions to ruby on rails programming language. This is basically a web application framework, which is written in ruby language. Ruby on rails programming language usages a Modal-View-Controller architecture and based on object oriented programming. The good thing about this programming language is that it is a open source and freely released.
In this example we are going to discuss "Hello World" example in Ruby on Rails. We are developing this application via using Net Beans IDE. You must have Ruby on Rail plug in of Net Beans.
First of all start NetBeans IDE.
Create new project via File >> New Project
Select Ruby from Categories and select Ruby on Rails Application from Projects
Click on Next button
Give the project name according to you ( e.g we have taken by default name RailsApplication1) and click on next
Configure the database configuration
Click on Create DB button to configure database
set host name, port number, username and password and after this give database name
After creating database connection click on Ok button
Now Database Configuration window will look like this
Click on Next button and finally click on Finish
It will take 1-2 seconds in creating RailApplication1's whole environment
Now your project window will consists of project "RailApplication1"
Now you can check that what you have done so far. So go to Run >> Run Main Project to run application
Now it will boot WEBrick server to run Rail application and you have following output on your set browser. It means that you have done all setting perfectly.
Now to create further pages in your Application go to controllers and right click on it and select Generate command to generate view.
and create controller by clicking on Ok
In your project explorer student folder would be created
Create a view page with .rhtml extension in student folder
and type Hello world in this file list.rhtml.
|class StudentController < ApplicationController
Create a new method list in student_controller.rb and run project.
and type the following URL into your address bar as http://localhost:3000/student/list, you will have following output on your browser as follows:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: October 3, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles