fix compatibility with rails >= 4