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} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^/?$ “http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}” [P,QSA,L]
Explanation,
Line 1 define domain.com or
Line 2 define www.domain.com
Line 3 define to redirect to localhost(127.0.0.1) 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=============
YOU SHOULD CHANGE IT TO METHOD AS BELOW.
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^(.*)$ “http\:\/\/127\.0\.0\.1\:12001%{REQUEST_URI}” [P,QSA,L]
Note:
The change is Line 3 only with red color.
==========CORRECT RULES=============
One thought on “Ruby on Rails Handy Guide”
Comments are closed.