Skip to content

Commit

Permalink
[ci skip] document type_cast_for_write
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed May 7, 2014
1 parent e5ac6c8 commit 43fbdba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions activerecord/lib/active_record/connection_adapters/column.rb
Expand Up @@ -72,6 +72,8 @@ def binary?
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?

Expand Down
Expand Up @@ -98,6 +98,9 @@ def self.extract_value_from_default(default)
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)
Expand Down

0 comments on commit 43fbdba

Please sign in to comment.