Make it compatible with Ruby 2 and Rails 3