Bringing change to make it work in rails 4