Add :encode_with to sql_literal for proper YAML serialization

This patch fixes https://github.com/rails/rails/issues/5303