PhidgetSBC2 and ruby

Installing ruby (and the phidgets-ffi gem) on the PhidgetSBC2 is fairly simple. You will need to check Include full Debian Package Repository under System > Packages in the SBC admin page. And then just ssh into the server and run the following: apt-get update && apt-get install ruby1.9.1 ruby1.9.1-dev build-essential -y And then you can […]

Simple Rails Multi-Tenancy II

I suppose it’s about time I updated my Simple Rails Multi-Tenancy post to use the latest rails 3.1.1. Not much has changed from the 3.0 beta to 3.1.1 in terms of the method I use to achieve multi-tenancy but the code has become a bit cleaner (but the patch required is a bit larger). This […]

jruby with 1.9 mode as the default with rvm

Thanks to recent commits from Wayne, you can now pass a build flag when install jruby with rvm and it will build jruby instead of downloading a prebuilt copy. Make sure you rvm get head && rvm reload first. Then we can install jruby with 1.9 mode as the default: rvm install jruby -C -Djruby.default.ruby.version=1.9 […]

Parsing Proxy Auto-Config files

One thing I’ve always been wanting to be able to do was parse a proxy auto-config file from the command line. I only recently found the pacparser library but found it limiting because it isn’t easy to install and use. So I decided to write a rubygem that would parse a pac file. I started […]

Addendum: mysql2 ruby gem and Mac OS X: image not found

Back at the start of April I wrote mysql2 ruby gem and Mac OS X: image not found to deal with the extremely relative path to libmysqlclient.16.dylib. I had said I would prefer not putting libmysqlclient.16.dylib in /usr/lib but I couldn’t find a dylib path that ruby uses. That is until today when I decided […]

mysql2 ruby gem and Mac OS X: image not found

If you are using the mysql2 ruby gem on Mac OS X you may have run into this problem before. > require 'mysql2' LoadError: dlopen(mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib Referenced from: mysql2-0.2.7/lib/mysql2/mysql2.bundle Reason: image not found – mysql2-0.2.7/lib/mysql2/mysql2.bundle So far the only solution I have found online is to use install_name_tool to update the […]

Simple Rails Multi-Tenancy

With some recent commits to rails comes the ability to have a default_scope with a lambda that gets evaluated at query time. Combine that with a multi-tenant column scoped database structure (wow, quite the mouthful) and you’ve got an quick and painless way to partition your tenant data without scattering code everywhere.

Playing with FormBuilder

The┬ámethods that come with the standard ActionPack::Helpers::FormBuilder cover most cases of what you need to do but if you need to do something it doesn’t have a method for, things can get a little ugly. In my case I wanted to create a helper for autocompleted fields that all had the same attributes but different […]