1.1. Install InstantRails 2.0
- Download InstantRails-2.0-win.zip from http://rubyforge.org/projects/instantrails/
- Extract InstantRails-2.0-win.zip to c:\
1.2. Install Aptana Studio
- Download Aptana_Studio_Setup_1.2.5.exe from http://www.aptana.com/studio/download
- Install Aptana studio by following the prompted instruction of Aptana.
1.3. Install MYSQL GUI Tools
- Download mysql-gui-tools-5.0-r17-win32.msi from http://dev.mysql.com/downloads/gui-tools/5.0.html
- Install MYSQL GUI Tools by following the prompted instruction of MYSQL.
1.4. Modify MYSQL root password though phpmyadmin
1.5. Create database and tables in MYSQL
- Create database named by issuing the SQL statement - [ create database taxi_production; ]
- Create database named by issuing the SQL statement - [ create database taxi_development; ]
- Create database named by issuing the SQL statement - [ create database taxi_test; ]
- Create TWO tables called passenger_origin and passenger_destination in taxi_production database with following SQL statement
=============================================
CREATE TABLE `taxi_production`.`passenger_origins`
(
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(45) NOT NULL,
`contact` int(10) unsigned NOT NULL,
`suburb` varchar(45) NOT NULL,
`street` varchar(45) NOT NULL,
`building` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
=============================================CEATE TABLE `taxi_production`.`passenger_destinations`
(
`id` int(10) unsigned NOT NULL auto_increment,
`suburb` varchar(45) NOT NULL,
`numpass` varchar(45) NOT NULL,
`taxitype` varchar(45) NOT NULL,
`time` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
===============================================
1.6. Test on Ruby on Rails
- Create a booking system web application by Issuing command - [ rails -d mysql C:\rails_apps\bookingsys]
- Startup the bookingsys production web appliaction, please go to bookingsys directory and issue the command [mongrel_rails start -e production]
- Test the bookingsys web application by internet explorer with the url - [ http://localhost:3000/ ] (listening port for new web application is 3000 by default)
- Configure Rails to point to a target database by editing database.yml file which is located at C:\rails_apps\bookingsys\config as follows
=========================
production:
adapter: mysql
encoding: utf8
database: taxi_production
username: root
password: 123456
host: localhost
=======================
1.7. Create a model for taxi online booking system in the bookingsys directory by issuing the command [ ruby script/generate model passenger_origin ] & [ ruby script/generate model passenger_destinations]
1.8. Create a controller for taxt online booking system in the bookingsys directory by issuing the command [ruby script/generate controller taxicontrol ]
1.9. Install plugin named scaffold for taxt online booking system in the bookingsys directory by issuing the command [ruby script\plugin install scaffolding ]2.0. Install plug-in named paginate in the bookingsys by issuing the command [C:\InstantRails\rails_apps\bookingsys>ruby script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination]
2.1.Edit the controller file named taxicontrol_controller.rb and input the following statement within the class of TaxicontrolController
========================================
class TaxicontrolController <>Controller
scaffold :passenger_origin
end
========================================
2.2. Reset the taxi booking system web application server.
2.3. Access the taxicontrol page by browsing the url at http://localhost:3000/taxicontrol
2.4. Click the button namely "New passenger orgin", and it will load a form, then just need fill in all fields and click create button , those field records will insert in to database (please the below figure for referance)

Figure 1.

Figure 2.
Figure 3.
2.5. Check the data whether stores in the database by using MYSQL GUI tools, please see the below figure for referance
沒有留言:
發佈留言