Upgrade to rails 4

A working version tested on Rails 4.1.4