7th
Getting started with Ruby on Rails
After meddling with Merb and Haml for a while I have switched to Rails. Merb’s lack of good docs and tutorials pushed me to make this change. And after a quick scan of the Rails docs I could get it running in a couple of minutes. Here’s a quick 4-step overview as to what is supposed to be done to get Rails running with MySQL and Haml on windows. Linux users can omit the ‘ruby’ prefix keyword. Before doing the below you’ll need to download and installĀ MySQL, Ruby and RubyGems. After it’s done. Follow thru.
1.) Installing Rails
gem install rails
2.) Creating a rails app. cd to a dir where you want your app to reside and use
rails myapp -d mysql
The -d mysql instructs Rails to use MySQL database as the default. The above command generates rails specific files. Look at the end of this post for some MySQL and Windows specific details.
2.) Install Haml. A templating system. It’s similar to Smarty for PHP.
gem install haml
3.) Add the Haml plugin to your rails app
haml —rails path_to_myapp
As an interesting fact, a meta-language called Sass comes with Haml. More on Sass later.
4.) Done! Now you should be able to run your rails app with the command:
ruby script/server
Visit http://localhost:3000 and you should see your welcome message.
For Windows users: If the server generates an error that libmysql.dll cannot be found, copy the libmysql.dll file from the bin dir in the MySQL install dir and get it into the ruby install dir (c:\ruby by default)
My Bookmarks