Ruby on Rails Handy Guide

Some Useful command
To install ruby Gem,
gem install [gem_name]
eg, gem install rails

To install ruby Gem with certain version,
gem install [gem_name] –version=x.x.x
eg, gem install rails –version=2.3.5
eg, gem install rails -v=2.3.5

To update ruby Gem,
gem update [gem_name]
eg, gem update mysql

To update ruby Gem with latest version(for all)
gem update –system

To check missing gem
rake gems:install (must run from rails apps folder)

To install gem with lesser space
gem install –no-rdoc –no-ri [gem_name]
eg. gem install –no-rdoc –no-ri rails

To check RoR log,
Path: /home/[cpanel_username]/etc/rails_apps/[apps_name]/log

development.log – For development type purpose
production.log – For production type purpose, normally you should use this to check if any error.
mongrel.log – cPanel used mongrel to connect to Ruby, you may check here if the mongrel running

If you found client rewrite rules not working

When you create a rewrite rules from cPanel, you might get bug from cPanel and the RoR not working, below is the sample rewrite rules created by cPanel.

=========SAMPLE REWRITE RULES=========
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^/?$ “http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}” [P,QSA,L]

Line 1 define or
Line 2 define
Line 3 define to redirect to localhost( with port 12001 (declared by cPanel once you created the RoR and the port should start from 12001 to 12999).

=========SAMPLE REWRITE RULES=========

==========CORRECT RULES=============
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$ “http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}” [P,QSA,L]

The change is Line 3 only with red color.
==========CORRECT RULES=============

Published by

Mick Genie

Mick Genie is the founder of and working at ExaBytes Network Sdn Bhd and WPWebHost web host company. He is expertise in Windows and Linux environment especially web hosting related information, tips and trick as well as the IT Information.

One thought on “Ruby on Rails Handy Guide”

Comments are closed.