converted to rails 4