Skip to content

Commit

Permalink
all attributes serialized before writing
Browse files Browse the repository at this point in the history
  • Loading branch information
akostadinov committed Aug 2, 2021
1 parent 5a158ed commit 50d8382
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,9 @@ def write_lobs(table_name, klass, attributes, columns) #:nodoc:
value = attributes[col.name]
# changed sequence of next two lines - should check if value is nil before converting to yaml
next unless value
if klass.attribute_types[col.name].is_a? Type::Serialized
value = klass.attribute_types[col.name].serialize(value)
# value can be nil after serialization because ActiveRecord serializes [] and {} as nil
next unless value
end
value = klass.attribute_types[col.name].serialize(value)
# value can be nil after serialization because ActiveRecord serializes [] and {} as nil
next unless value
uncached do
unless lob_record = select_one(sql = <<~SQL.squish, "Writable Large Object")
SELECT #{quote_column_name(col.name)} FROM #{quote_table_name(table_name)}
Expand Down

0 comments on commit 50d8382

Please sign in to comment.