Update to Rails 4, keep 3.2 compatibility

Drop support to Rails 3.1 and Ruby 1.8