updated to support Rails 3.2.13 onwards