Creating basic Ruby on Rails application
Rails is a web application framework that uses Ruby Programming Language . It uses MVC ( Model, View, Controller ) architecture.
Model represents data of the application and handles data processings.
View is responsible for displaying the results of an action. There can be many different views in a web application, because web applications can display many different pages in the user’s browser.
Controller provides connectivity between model and view. The controller supervises the entire application, handling request as needed.
To create a simple rails application
1. open the terminal and type the command
$ rails tax
2. Now use the scaffold command.
$ script/generate scaffold detail name:string doj:date address:text basic:float hra:float medicalallowance:float conveyance:float otherallowance:float
Rails can automatically create a full set of CRUD (Create, Retrieve, Update, and Delete) operations and views on any database table. This scaffolding can get you up and running quickly with manipulating your database tables.It automatically creates Model, view and controller.
3. $ rake db:create
It will create a database.
4. $ rake db:migrate
It will update the database with information from the migration file.
5. To start the WEBrick server
$ script/server
6. In the address bar of your browser type http://localhost:3000/details
you will get LISTING DETAILS , here by clicking at the link ‘ new details ‘ you can enter the employee details.
Recent Comments