Updated to work on Rails 4.1