aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/type')
-rw-r--r--activerecord/lib/active_record/type/date.rb4
-rw-r--r--activerecord/lib/active_record/type/decimal.rb4
-rw-r--r--activerecord/lib/active_record/type/time_value.rb4
-rw-r--r--activerecord/lib/active_record/type/value.rb4
4 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/type/date.rb b/activerecord/lib/active_record/type/date.rb
index 45c69460ef..d90a6069b7 100644
--- a/activerecord/lib/active_record/type/date.rb
+++ b/activerecord/lib/active_record/type/date.rb
@@ -9,6 +9,10 @@ module ActiveRecord
::Date
end
+ def type_cast_for_schema(value)
+ "'#{value.to_s(:db)}'"
+ end
+
private
def cast_value(value)
diff --git a/activerecord/lib/active_record/type/decimal.rb b/activerecord/lib/active_record/type/decimal.rb
index 1c0147a797..6eed005345 100644
--- a/activerecord/lib/active_record/type/decimal.rb
+++ b/activerecord/lib/active_record/type/decimal.rb
@@ -11,6 +11,10 @@ module ActiveRecord
::BigDecimal
end
+ def type_cast_for_schema(value)
+ value.to_s
+ end
+
private
def cast_value(value)
diff --git a/activerecord/lib/active_record/type/time_value.rb b/activerecord/lib/active_record/type/time_value.rb
index 6cc19b6379..d611d72dd4 100644
--- a/activerecord/lib/active_record/type/time_value.rb
+++ b/activerecord/lib/active_record/type/time_value.rb
@@ -5,6 +5,10 @@ module ActiveRecord
::Time
end
+ def type_cast_for_schema(value)
+ "'#{value.to_s(:db)}'"
+ end
+
private
def new_time(year, mon, mday, hour, min, sec, microsec, offset = nil)
diff --git a/activerecord/lib/active_record/type/value.rb b/activerecord/lib/active_record/type/value.rb
index 9a4adc60cc..9c1e9dc01e 100644
--- a/activerecord/lib/active_record/type/value.rb
+++ b/activerecord/lib/active_record/type/value.rb
@@ -27,6 +27,10 @@ module ActiveRecord
type_cast_for_write(value)
end
+ def type_cast_for_schema(value)
+ value.inspect
+ end
+
def text?
false
end