Upgrade to Rails 4

Following the official (but still in progress) upgrading guide:
http://guides.rubyonrails.org/upgrading_ruby_on_rails.html

Mostly changing methods arguments to adjust to new signatures, adapting
to new conventions (new-style hashes) and replacing deprecated methods
and configurations.

Gemfile updated accordingly.

Also changes testing to use the Turn gem already added.