edited with rails assignment no. 3