Cannot execute Rake Task in production environment? Does it throws errors of uninitialized objects or refuses to load Model classes?
To execute a rake task for eager loading we require,
config.threadsafe! to be disabled in production which is enabled by default.
But our requirement is to get it disabled only on running a rake task.
Rake already sets a Ruby global: $rails_rake_task
So, in config/environments/production.rb, just say:
config.threadsafe! unless $rails_rake_task
RVM relies on GIT.
So set proxy for GIT first.
* Set the http_proxy environment
* Set a proxy command to bypass the connection:
gcc -o connect connect.c
mv connect ~/bin
echo “/home/kiran/bin/connect -H proxy.company.com:6030 $@” >> ~/bin/proxy
chmod +x ~/bin/proxy
echo “export GIT_PROXY_COMMAND=proxy” >> .bashrc
Now try git clone. If it doesnt work, try out the following the command.
This line below also works like a charm for GIT,
git config --global http.proxy proxy_addr:proxy_port
Once the GIT is configured, for RVM, you need to do one more change for curl,
Set the proxy inside your ~/.curlrc
proxy = proxy.company.com:proxy_port
and now you can install rvm with no issues.
For rvm install thru proxy:
rvm install X --proxy proxy.company.com:proxy_port
If two developers are under the same user-group, we can even clone/copy the .rvm folder within two users without explicit installations.
Some more references:
http://zipizap.wordpress.com/2010/11/02/cloning-rvm-to-other-user-you-can-just-copy-the-rvm-directory/ [This worked for me as well]