update code syntax for rails 4