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

Continue reading Ruby on Rails Handy Guide

All in one redirect scripting

HTML redirect:

For most of the webmaster, they will prefer 301 Redirect. With HTML redirect with HTML, I will suggest canonical type.

You may use the following script from the HTML with canonical redirection.

<link rel="canonical" href="" />

htaccess with mod_rewrite redirect:

If you are using Apache or Mod_Rewrite enabled Web services, htaccess with mod_rewrite redirect is very useful, you may use the following script to perform your redirection.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^
RewriteRule (.*)$1 [R=301,L]

ColdFusion Redirect:

Sample code for Cold Fusion.

<cfheader name="Location" value="">

PHP Redirect:

Sample code for PHP.


ASP Redirect:

Sample Code for ASP.

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", ""

ASP.Net Redirect:

Sample Code for ASP.Net.

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)

Java Redirect:

Sample Code for Java.

response.setHeader( "Location", "" );
response.setHeader( "Connection", "close" );

Perl & CGI redirect:

Sample Code for Perl & CGI.

$q = new CGI;
print $q-› redirect(" ");

Ruby & Ruby on Rails Redirect:

Sample code for Ruby & Ruby on Rails.

head :moved_permanently, :location =› "