Updated device for rails 4