Ruby on Rails: All Aboard the Fast Train to Web Application Development, Page 2
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:
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
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.
- Ruby: http://www.ruby-lang.org/en/
- Ruby on Rails: http://www.rubyonrails.org/
- An Interview with David Heinemeier Hansson: http://www.oreillynet.com/pub/a/network/2005/08/30/ruby-rails-david-heinemeier-hansson.html
- RubyGems: http://rubygems.rubyforge.org/
- MySql: http://www.mysql.com/
- SilvaSoft, Inc. weblog: http://jroller.com/page/silvasoftinc
About the Author
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.
Page 2 of 2