Skip to content

Commit

Permalink
Don't store "_old_" if we're passed nil
Browse files Browse the repository at this point in the history
  • Loading branch information
artfuldodger committed Apr 12, 2017
1 parent d923685 commit 2070faa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/carrierwave/mongoid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def #{column}=(new_file)
column = _mounter(:#{column}).serialization_column
# mongoid won't upload a new file if there was no file previously.
write_uploader(column, '_old_') if self.persisted? && read_uploader(column).nil?
write_uploader(column, '_old_') if self.persisted? && read_uploader(column).nil? && !new_file.nil?
send(:"\#{column}_will_change!")
super
Expand Down

0 comments on commit 2070faa

Please sign in to comment.