aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2014-05-07 11:09:33 -0500
committerschneems <richard.schneeman@gmail.com>2014-05-07 11:09:33 -0500
commit43fbdbae17744458d71262836b451d68427bd98d (patch)
treea1c66c02ff50dd33dd87be378ccb6b1447437939 /activerecord
parente5ac6c8753dc11a1f9869c4fe48a11dc8a32280d (diff)
downloadrails-43fbdbae17744458d71262836b451d68427bd98d.tar.gz
rails-43fbdbae17744458d71262836b451d68427bd98d.tar.bz2
rails-43fbdbae17744458d71262836b451d68427bd98d.zip
[ci skip] document type_cast_for_write
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/connection_adapters/column.rb2
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/column.rb3
2 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb
index 187eefb9e4..38efebeaf3 100644
--- a/activerecord/lib/active_record/connection_adapters/column.rb
+++ b/activerecord/lib/active_record/connection_adapters/column.rb
@@ -72,6 +72,8 @@ module ActiveRecord
end
# Casts a Ruby value to something appropriate for writing to the database.
+ # Numeric columns will typecast boolean and string to appropriate numeric
+ # values.
def type_cast_for_write(value)
return value unless number?
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb
index 2cbcd5fd50..3558a641e2 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb
@@ -98,6 +98,9 @@ module ActiveRecord
end
end
+ # Casts a Ruby value to something appropriate for writing to Postgresql.
+ # see ActiveRecord::ConnectionAdapters::Class#type_cast_for_write
+ # see ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Type
def type_cast_for_write(value)
if @oid_type.respond_to?(:type_cast_for_write)
@oid_type.type_cast_for_write(value)