Installing gems to user directory - Configurations - How to?

I compiled Ruby from source, and installed it to /opt/ruby/ .
The purpose is to have two versions of Ruby 1.9 and Ruby 1.8 … Certain
users can use 1.9

After creating a rails app (rails new app) , When a script performs
bundle install, the gems are trying to get installed in /opt/ruby/.
How to configure it to install it in user_home directory ?

I don’t want to use the solution, where I install the gems as the root
user
to the ruby bin directory.

This is the error that I get:

Gem::Exception: Cannot load gem at
[/opt/ruby/lib/ruby/gems/1.9.1/cache/multi_json-1.7.7.gem] in
/home/boopathi/apps/abcd
An error occurred while installing multi_json (1.7.7), and Bundler
cannot
continue.
Make sure that gem install multi_json -v '1.7.7' succeeds before
bundling.

You could use rvm or rbenv instead.

Boopathi Rajaa wrote in post #1113443:

I compiled Ruby from source, and installed it to /opt/ruby/ .
The purpose is to have two versions of Ruby 1.9 and Ruby 1.8 … Certain
users can use 1.9

After creating a rails app (rails new app) , When a script performs
bundle install, the gems are trying to get installed in /opt/ruby/.
How to configure it to install it in user_home directory ?

I don’t want to use the solution, where I install the gems as the root
user
to the ruby bin directory.

Are you not able to use one of the Ruby version managers?

or
https://rvm.io