updated to support rails 4