Updated to work with rails 4, all tests passing, though with some deprecation notices.