add compatibility with rails 4