Apply #457 from bcardarella/client_side_validations for Rails 4.