changes optimized for Rails 3.2.8 and higher