remake with rails ver. 4.1.0