udpated for rails 4