Trying to make it work for rails 4