diff --git a/activemodel/lib/active_model/type/helpers/numeric.rb b/activemodel/lib/active_model/type/helpers/numeric.rb index a481151ebdb..5b1db1f36b6 100644 --- a/activemodel/lib/active_model/type/helpers/numeric.rb +++ b/activemodel/lib/active_model/type/helpers/numeric.rb @@ -7,7 +7,6 @@ module ActiveModel def serialize(value) cast(value) end - alias :unchecked_serialize :serialize def cast(value) # Checks whether the value is numeric. Spaceship operator diff --git a/activemodel/lib/active_model/type/value.rb b/activemodel/lib/active_model/type/value.rb index 6b406f8349f..1bcebe1b6b7 100644 --- a/activemodel/lib/active_model/type/value.rb +++ b/activemodel/lib/active_model/type/value.rb @@ -53,7 +53,6 @@ module ActiveModel def serialize(value) value end - alias :unchecked_serialize :serialize # Type casts a value for schema dumping. This method is private, as we are # hoping to remove it entirely. diff --git a/activerecord/lib/active_record/enum.rb b/activerecord/lib/active_record/enum.rb index 1a94a0a349d..54463c9e883 100644 --- a/activerecord/lib/active_record/enum.rb +++ b/activerecord/lib/active_record/enum.rb @@ -146,7 +146,6 @@ module ActiveRecord def serialize(value) mapping.fetch(value, value) end - alias :unchecked_serialize :serialize def assert_valid_value(value) unless serializable?(value) diff --git a/activerecord/lib/arel/nodes/homogeneous_in.rb b/activerecord/lib/arel/nodes/homogeneous_in.rb index 98b69d1f145..fe97894a0fc 100644 --- a/activerecord/lib/arel/nodes/homogeneous_in.rb +++ b/activerecord/lib/arel/nodes/homogeneous_in.rb @@ -44,7 +44,7 @@ module Arel # :nodoc: all type = attribute.type_caster casted_values = values.map do |raw_value| - type.unchecked_serialize(raw_value) if type.serializable?(raw_value) + type.serialize(raw_value) if type.serializable?(raw_value) end casted_values.compact! diff --git a/activerecord/lib/arel/visitors/to_sql.rb b/activerecord/lib/arel/visitors/to_sql.rb index b0e92a9b5af..9c2bd307ed3 100644 --- a/activerecord/lib/arel/visitors/to_sql.rb +++ b/activerecord/lib/arel/visitors/to_sql.rb @@ -327,9 +327,9 @@ module Arel # :nodoc: all collector << quote_table_name(o.table_name) << "." << quote_column_name(o.column_name) if o.type == :in - collector << "IN (" + collector << " IN (" else - collector << "NOT IN (" + collector << " NOT IN (" end values = o.casted_values.map { |v| @connection.quote(v) } diff --git a/activerecord/test/cases/relation/where_test.rb b/activerecord/test/cases/relation/where_test.rb index 817b44faf51..18e086690c4 100644 --- a/activerecord/test/cases/relation/where_test.rb +++ b/activerecord/test/cases/relation/where_test.rb @@ -366,6 +366,12 @@ module ActiveRecord assert_equal 0, count end + def test_where_with_emoji_for_binary_column + Binary.create!(data: "🥦") + assert Binary.where(data: ["🥦", "🍦"]).to_sql.include?("f09fa5a6") + assert Binary.where(data: ["🥦", "🍦"]).to_sql.include?("f09f8da6") + end + def test_where_on_association_with_custom_primary_key author = authors(:david) essay = Essay.where(writer: author).first