The Silver Lining

Lessons & Learnings from a salesforce certified technical architect.

Posts Tagged ‘errors

Ruby, Rails & RVM woes

with one comment

I’ve had several issues over the past day pertaining to Ruby, Rails and RVM and all of them were caused by one silly thing.

Problem 1: You can’t swap between Ruby versions using RVM

If you can’t swap between Ruby versions that you know you’ve installed then you’ve probably installed something using “sudo”. It is highly recommended that you install & use RVM in the single user mode as this is easiest. If you do this then all the versions of Ruby etc. that you install will be installed in your home directory (usually ~/.rvm/) instead of system wide and this negates a whole bunch of complexities. Running this command will tell you which ruby executable you’re using:


which ruby

If the executable is not sitting in your home directory e.g. it’s in /usr/local/bin then you’re in a spot of bother. The easiest way I’ve found to fix this is to clear out all the RVM gemsets and start again. I’ve found that I needed to run:


rm -fr ~/.rvm

rm -fr ~/.bin

Be careful with the second command. I’d have a look around that directory before deleting it to make sure it’s not being used by anything else.

Having wiped out these directory you can now using RVM to install fresh versions of Ruby.

Problem 2: Running “rails -v” or “rails” throws an error similar to “`report_activate_error’: Could not find RubyGem rails’

This is assuming you don’t have the first problem or that you’ve corrected it. It’s also most likely to occur if you’re using RVM. The cause here is that you’re using a local version of RVM to manage your Ruby versions but have installed Rails using “sudo” so that it’s been installed system wide. The solution is simple, remove the “sudo” so that rails is installed just for your currently active gemset.


gem install rails --version x.y.z

Advertisements

Written by Wes

August 7, 2011 at 1:38 pm

Posted in Rails, Ruby, RVM

Tagged with , , , , ,

DML currently not allowed

with 14 comments

This almost belongs in my sarcastically titled, “Meaningful Error Messages ..” series, but as it has traceable causes, I thought I’d write something up on it’s most frequent causes (I meant to write this up a few months ago, but it slipped my mind (find it in your heart to forgive an ol’ developer) and now I think it’s time the world knew).

‘DML currently not allowed’, what could that mean? Well it means that DML isn’t allowed. And that it’s not allowed right now, but with the slight promise that given time, it will be allowed. Often in the past, hoping against hope, I kept on pressing that button/link/onclick-area, but the cloud never changed it’s mind. With a sigh I constructed the google-search query and began trundling through the results. Read the rest of this entry »

Written by Wes

November 23, 2009 at 6:14 pm

%d bloggers like this: