1. Set up the MySQL tools on your computer as described in section 6 above.
I had install the 'Sequel Pro' in my Mac, use it to connect the MySQL database named test, browse the table employees in it:

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)
Run the Locomotive and Create Rails Application named OTBS:

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.
Running Rails in my Mac:

The database.yml that under the config folder:

4. Generate the Passenger model by creating the MySQL database and ‘passengers’ table from the information above.
Create the table passengers in database OTBS by MySQL tools Sequel Pro:

Generate the Passenger model in the Terminal: ruby script/generate model Passenger

The model Ruby class located in app/models/passenger.rb:

5. Further work on understanding MySQL under Rails by David Mertz:
a. See “Fast-track your Web apps with Ruby on Rails” at http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/
Summary after reading of the “Fast-track your Web apps with Ruby on Rails”:
- Introducing Rails - Rails provides a very clear and focused MVC way of thinking
- Describe how to building a simple application
- Describe how to creating customizable content
- Describe how to changing the model
- Rails gives us a extremely quick way to develop flexible Web applications.
- Rails development offers us a clear path from a half-formed idea to a fully functioning Web applciation.
Summary after reading of the “Rolling with Ruby on Rails” series and “Cookbook recipes by Curt Hibbs":
- The article steps through using Rails to develop a Web application
- What are Ruby and Rails?
- Installation steps of Ruby on Rails (install: Ruby, Rails, MySQL, MySQL-Front)
- Create an empty Rails Web application (eg. Run the command: rails cookbook)
- Test the empty Web application (eg. Run the command: ruby script\server)
- Introduction of Rails application's directory structure
- Create Controller class (eg. Run the command: ruby script\generate controller Mytest)
- How to use the index method of MytestController to display 'Hello World' ?
- How to create database and table in MySQL using MySQL-Font
- Create Model (eg. Run the command: ruby script\generate model Recipe)
- How to create, list and delete database record by using the Controller and add the command scaffold?
- How to create actions and Views?
- How to assign relationship between tables and make them work in the Rials?
Hi Dennis,
ReplyDeleteI think we should rake the table from rails into MySQL rather creating the table from SQL in question 4 here.