Friday, April 16, 2010

Workshop 3

1. Set up the MySQL tools on your computer as described in section 6 above.

The GUI tool is called MySQL Workbench, and is downloaded from http://www.mysql.com/products/tools/. The latest GA version is 5.1.18a. A Microsoft MSI installation file is available. After installation, it is running successfully and the screen shot is as follow.




2. Rails will setup a new application directory for each of your Web application projects. Get InstantRails (Windows) or Locomotive (MacOS) running on your machine. Both packages install Ruby, Rails, a Web server or one called ‘Mongrel’ or another small Ruby Web server called ‘WEBrick’, and MySQL “inside a bubble” as I call it so that others parts of your system are not modified (Similarly ZOPE does with installing its own Web server and Python versions).

I did not install InstantRails, but the Ruby and Rails from rubyforge.org. The version is 1.86-27, it is an older one but stable.




The RoR is installed successfully, and the folder c:\Ruby is created.

In this version, the RubyGems is not necessary to installed separately. But according to the installation instruction, two instructions to update the RubyGems are required.


C:\rudy> gem update rails

C:\ruby>gem install rails—include-dependencies (takes quite a while)

After installation is completed, the online taxi booking system (OTBS) is created by running command from the Ruby folder.





Associated folders are created.








To start the WEBrick server, below command is run at the c:\ruby\otbs folder.










3. Once Rails is running you at http://localhost:3000, you need to configure database access. Connection to the database is specified in the config/database.yml file.

The port at 3000 of Rails is running as shown as follow:





The detail of the config/database.yml is shown below. The database that connected from three environment ‘development’, ‘test’ and ‘production’ are specified by default.




4. Generate the Passenger model by creating the MySQL database and ‘passengers’ table from the information above.

The procedure can be straightly followed through the Ruby on Rails instructions:

(a) Showing options by running without parameters





(b) Running script/generate command with table ‘Passengers’ and columns





The models and controllers folders are created





(c ) Run rake command to migrate the database


















No comments:

Post a Comment