http://www.developer.com/open/article.php/3647796/Ruby-on-Rails-All-Aboard-the-Fast-Train-to-Web-Application-Development.htm
Ruby is the programming language on the tip of everyone's tongue these days. The power and ease of software development with Ruby has helped make an upstart web framework called Ruby on Rails the hottest web framework around. Some may argue that the Web 2.0 wave is riding the Rails on Rails wave, as more and more Ruby on Rails powered web sites pop up on the internet. This article will give a brief introduction to Ruby on Rails and show you how to get your first simple Ruby on Rails web application up and running. In Part 2 of this article, you will connect your web application to the MySQL database and add CRUD (Create, Read, Update, and Delete) support to the web application. It is hard to imagine anyone in the programming world these days who has not heard of Ruby. The ever-increasing popularity of the Ruby on Rails web framework is helping to make Ruby the language of choice for rapid application development and testing. Ruby is an interpreted scripting language that provides quick and easy object-oriented programming and contains some neat features such as closures, blocks, and mixins. Ruby is also highly portable, running on Unix/Linux, Windows, and MacOS. For those wanting a more thorough introduction to Ruby, you can read W. Jason Gilmore's article on Ruby. Ruby on Rails was created by David Heinemeier Hansson, a partner of 37 signals, as a web application framework for building their web applications. David open sourced Ruby on Rails under the MIT license and it is now the fastest-growing web application framework. It is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern. It provides Ajax support in the view layer, a request and response controller, and a domain model wrapping the database. All that is needed to deploy a Rails web application is a web server and a database. In this article, you will download and install Ruby, the Rails framework, and MySQL so you can run your very first Ruby on Rails web application. Ruby runs on Window, Unix, Linux, and MacOS operating systems. This article will assume an installation of Ruby on Rails for a Windows-based operating system. The fastest way to Ruby up and running is to download the One-Click Ruby Installer for Windows. This is a one-click, self-contained installer that contains the Ruby language as well as dozens of popular extensions and packages, and editor and execution environment. Download the latest version, 1.8.5-21, and double-click the ruby185-21.exe executable, following the installation instructions to install Ruby. The one-click Ruby installer also installs RubyGems, the Ruby package manager. You can use RubyGems to download and install Ruby on Rails. Open a command prompt and run the following command: RubyGems will also download and install other libraries that Rails depends on. When prompted to install each of these, answer 'y'. Once RubyGems is complete you will have Rails version 1.1.6 installed: MySQL is the most popular open source database available. The latest version of the MySQL Community Server is version 5.0. You can download the MySQL 5.0 Community Server Windows Essentials (x86) installer. Double-click the installer and follow the installation instructions, accepting all defaults. Click the 'Finish' button on the final panel, and uncheck the 'Modify Security Settings' checkbox; this will allow you to access MySQL without a password. If you are not comfortable administering MySQL from the command line, you will want to download a graphical front-end client for MySQL. A good MySQL front-end application is HeidiSQL and you should download and install it so you can administer your MySQL database. Now that you have Ruby, Rails, and MySQL installed, you can create your first Rails web application. In addition to a runtime web application framework, Rails contains a set of helper scripts that are used to automate tasks when developing your web application. The first script you will need is the one that creates your web application template (directory structure and initial set of files). From a command window, go to the directory that you want your web application to live in and type the following: You now have a 'myfirstrailsapp' subdirectory that contains a complete directory tree of folders and files that make up an empty Rails web application. Now, run this Rails application. Change to the 'myfirstrailsapp' directory and run the following command: Your Rails application is now up and running on your local machine, on port 3000. WEBrick is a Ruby-based web server that is bundled with Rails and runs on port 3000 by default. Point your web browser to http://localhost:3000/ and you will see your empty Rails application up and running: The one thing you may have noticed is that you have not written a single line of code, yet you have a running (empty) web application. With other web application frameworks in languages such as Java, .NET (C# and VB.NET), and PHP, you would need to create directory structures, configuration files, and other web application artifacts. That is the beauty of Rails; it does most of the initial setup work for you, leaving you with the task of writing your application and business logic. This article has provided a brief introduction to Ruby on Rails. We showed you how to get up and running with Ruby on Rails in a short time. In Part 2 of this article, you will connect your web application to the MySQL database and add CRUD (Create, Read, Update, and Delete) support to the web application. Dominic Da Silva (http://www.dominicdasilva.com/) is the President of SilvaSoft, Inc., a software consulting company specializing Java, Ruby, and .NET-based web and web services development. He has worked with Java since the year 2000 and is a Linux user from the 1.0 days. He is also Sun Certified for the Java 2 platform. Born on the beautiful Caribbean island of Trinidad and Tobago, he now makes his home in sunny Orlando, Florida.
Ruby on Rails: All Aboard the Fast Train to Web Application Development
December 7, 2006
Ruby: A Scripting Language Gem
Rails: The fast Train to Web Application Development
Installing Ruby
Installing the Rails Framework
C:>gem install rails --remote
C:>rails .v
Rails 1.1.6
Installing the MySQL Database
Running Your First Ruby on Rails Web Application
C:ROR>rails myfirstrailsapp
create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
create lib/tasks
create log
create public/images
create public/javascripts
create public/stylesheets
create script/performance
create script/process
create test/fixtures
create test/functional
create test/integration
create test/mocks/development
create test/mocks/test
create test/unit
create vendor
create vendor/plugins
create tmp/sessions
create tmp/sockets
create tmp/cache
create Rakefile
create README
create app/controllers/application.rb
create app/helpers/application_helper.rb
create test/test_helper.rb
create config/database.yml
create config/routes.rb
create public/.htaccess
create config/boot.rb
create config/environment.rb
create config/environments/production.rb
create config/environments/development.rb
create config/environments/test.rb
create script/about
create script/breakpointer
create script/console
create script/destroy
create script/generate
create script/performance/benchmarker
create script/performance/profiler
create script/process/reaper
create script/process/spawner
create script/runner
create script/server
create script/plugin
create public/dispatch.rb
create public/dispatch.cgi
create public/dispatch.fcgi
create public/404.html
create public/500.html
create public/index.html
create public/favicon.ico
create public/robots.txt
create public/images/rails.png
create public/javascripts/prototype.js
create public/javascripts/effects.js
create public/javascripts/dragdrop.js
create public/javascripts/controls.js
create public/javascripts/application.js
create doc/README_FOR_APP
create log/server.log
create log/production.log
create log/development.log
create log/test.log
C:ROR>
C:RORmyfirstrailsapp>ruby scriptserver
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2006-12-03 17:11:15] INFO WEBrick 1.3.1
[2006-12-03 17:11:15] INFO ruby 1.8.2 (2004-12-25) [i386-mswin32]
[2006-12-03 17:11:15] INFO WEBrick::HTTPServer#start: pid=3304 port=3000

Click here for a larger image.
Conclusion
References
About the Author