Update Rails to the latest version

https://trello.com/c/3lf2opEF

Previously, the application was running on an old version of Rails, which could possibly introduce security vulnerabilities. The application has been upgraded to Rails 4.0.2 and the code updated to work alongside this version.