transferred angular to rails code and working