Fix touching an invalid parent record for belongs_to

If the parent of a `belongs_to` record fails to be saved due to
validation errors, `touch` will be called on a new record, which causes
an exception (see https://github.com/rails/rails/pull/9320).

Example:

    class Owner < ActiveRecord::Base
      validates_presence_of :name
    end

    class Pet < ActiveRecord::Base
      belongs_to :owner, touch: true
    end

    pet = Pet.new(owner: Owner.new)

    # Before, this line would raise ActiveRecord::ActiveRecordError
    # "can not touch on a new record object"
    pet.save