aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/abstract/quoting.rb')
-rw-r--r--activerecord/lib/active_record/connection_adapters/abstract/quoting.rb25
1 files changed, 2 insertions, 23 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
index 947e11c7bf..d2840b9498 100644
--- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
+++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb
@@ -52,7 +52,7 @@ module ActiveRecord
def type_cast_from_column(column, value) # :nodoc:
if column
type = lookup_cast_type_from_column(column)
- type.type_cast_for_database(value)
+ type.serialize(value)
else
value
end
@@ -103,7 +103,7 @@ module ActiveRecord
end
def quote_default_expression(value, column) #:nodoc:
- value = lookup_cast_type(column.sql_type).type_cast_for_database(value)
+ value = lookup_cast_type(column.sql_type).serialize(value)
quote(value)
end
@@ -144,29 +144,8 @@ module ActiveRecord
binds.map(&:value_for_database)
end
- def type_for_attribute_options(type_name, **options)
- klass = type_classes_with_standard_constructor.fetch(type_name, Type::Value)
- klass.new(**options)
- end
-
private
- def type_classes_with_standard_constructor
- {
- big_integer: Type::BigInteger,
- binary: Type::Binary,
- boolean: Type::Boolean,
- date: Type::Date,
- date_time: Type::DateTime,
- decimal: Type::Decimal,
- float: Type::Float,
- integer: Type::Integer,
- string: Type::String,
- text: Type::Text,
- time: Type::Time,
- }
- end
-
def types_which_need_no_typecasting
[nil, Numeric, String]
end