Add gemspec and make rails 3 happy

Pulled some commits in from other forks to get it happy on rails 3.x