use Dan's code example for Rails 4 fix