RVM install ruby-1.8.7-p330 fails

Today I’m thinking of getting back into so good old work and I read there is a new patch to Ruby, version p330. So I figure that RVM (Ruby Version Manager) being so easy and quick to update, I’d do the good old “rvm get head, rvm reload, rvm update 1.8.7” and I’m off to the races. Well it wasn’t quite as simple. I ended up with an error: ruby-1.8.7-p330 - #fetching ruby-1.8.7-p330 - #extracting ruby-1.8.7-p330 to...

OSX 10.6.5 breaks Apachectl

Trying to run: sudo apachectl restart Are you getting: /usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument Edit your /usr/sbin/apachectl on line 65 from: ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`" to: ULIMIT_MAX_FILES="" and try again. It should now be working agian For more information checkout...

Blog's back up! (and a little update about Anlek Consulting)

I’m happy to say that the blog is back! Sorry for how long we were down but Anlek Consulting has moved offices and the local server (which was running this blog) was taken down and couldn’t be brought back up. So now we have a new home which should give us a better up time. A little update on what’s going on at Anlek Consulting. I (Andrew) will be doing a trip around Canada and the USA, hoping to be working on the road with my cell phone and free wifi...
Stripping ASCII colour from a ruby string

Stripping ASCII colour from a ruby string

I spent a few good hours trying to figure out how to strip a coloured ruby string: which comes out as this: >> p t"2 scenarios (e[33m2 undefinede[0m), 7 steps (e[36m2 skippede[0m, e[33m3 undefinede[0m, e[32m2 passede[0m)"=> nil Now I tried to gsub the string and remove the colour using a RegEx like this: > t.gsub(/\e[(d+)m/, "") => "2 scenarios (e[33m2 undefinede[0m), 7 steps (e[36m2 skippede[0m, e[33m3 undefinede[0m, e[32m2 passede[0m)" But as you can see, nothing...

MongoMapper – undefined method 'reflect_on_association'

Information Tidbit: If you’re using reflection_on_association with ActiveRecord and need to use it with MongoMapper, here is what you want to do: undefined method `reflect_on_association' for User:Class ActiveRecord: User.reflect_on_association(:posts).klass.new MongoMapper: User.associations[:posts].klass.new Mongoid: User.associations['posts'].klass.new notice the posts is a string, it will not work with a symbol UPDATE – (Apr 2011) Mongoid now follows...

Getting Paperclip to work with MongoMapper

Last night I was trying really hard to get MongoMapper to work with Paperclip via GridFS and failed. It seems right now Paperclip or even CarrierWave are not ready to be used with the latest MongoMapper drivers and GridFS (and I needed to use the latest drivers due to Scopify). After giving up using GridFS, I wanted to use Paperclip with MongoMapper with the normal file system and I found this article from Ben Curtis, however with the latest version of Paperclip...

MongoMapper logging to Rails log

I started playing around with MongoMapper for MongoDB and I have to say I’m loving it! Somehow it just feels so much easier to work with. However, I did have an issue with my code and needed to see whether or not MongoMapper was looking for account_id in my model. Since there is no sql to look at, I was looking for a way to see what MongoMapper was sending to MongoDB. Luckily the answer was very simple, in your connection string you just have to do this:...

uninitialized constant Rails::Railtie

A few days ago my app just stopped working, after a quick google search I found a great site that explains why: Jamie van Dyke that pointed out that inherited_resources has now fully moved to Rails 3 and will no longer work on Rails 2.3 or lower. Now Jamie seems to point to use older versions of the gem because they changed the code for Rails 3.0, however I feel that his versions aren’t the latest version you could be running. So I wanted to add my 2 cents by...

uninitialized constant Test::Unit::TestResult::TestResultFailureSupport Error

Today trying to run my RSpec tests and I get an odd error: uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError) /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:105:in `const_missing’ /usr/local/lib/ruby/gems/1.8/gems/test-unit-2.0.3/lib/test/unit/testresult.rb:28 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’...