Convert to gem for Rails 3.2 and greater