Skip to content

Commit

Permalink
Always set the blob field on the dup to avoid ActiveModel::MissingAtt…
Browse files Browse the repository at this point in the history
…ributeError
  • Loading branch information
dwbutler committed Jun 7, 2013
1 parent 5905651 commit 5873c20
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/serializable_attributes/schema.rb
Expand Up @@ -157,9 +157,9 @@ def reload(options = nil)

@model.send(:define_method, :dup) do
duplicate = super()
if raw_data = self.send(blob_field)
duplicate.send("#{blob_field}=", raw_data.dup)
end
raw_data = self.send(blob_field)
raw_data &&= raw_data.dup
duplicate.send("#{blob_field}=", raw_data)
duplicate.reset_serialized_data
duplicate
end
Expand Down

0 comments on commit 5873c20

Please sign in to comment.