Skip to content

Commit a13a710

Browse files
authored
Merge pull request #878 from yahonda/rails5_serialize_clob
Serialize value for lob columns
2 parents a5837e2 + 75ed13e commit a13a710

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/active_record/connection_adapters/oracle_enhanced_adapter.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,9 @@ def write_lobs(table_name, klass, attributes, columns) #:nodoc:
689689
value = attributes[col.name]
690690
# changed sequence of next two lines - should check if value is nil before converting to yaml
691691
next if value.nil? || (value == '')
692+
if klass.attribute_types[col.name].is_a? ActiveRecord::Type::Serialized
693+
value = klass.attribute_types[col.name].serialize(value)
694+
end
692695
uncached do
693696
sql = is_with_cpk ? "SELECT #{quote_column_name(col.name)} FROM #{quote_table_name(table_name)} WHERE #{klass.composite_where_clause(id)} FOR UPDATE" :
694697
"SELECT #{quote_column_name(col.name)} FROM #{quote_table_name(table_name)} WHERE #{quote_column_name(klass.primary_key)} = #{id} FOR UPDATE"

0 commit comments

Comments
 (0)