Make gem compatible with rails 4