lib/carrierwave/orm/mongoid.rb in locomotive_carrierwave-0.5.4.beta1 vs lib/carrierwave/orm/mongoid.rb in locomotive_carrierwave-0.5.4.beta2
- old
+ new
@@ -46,9 +46,18 @@
def #{column}_changed?
column = _mounter(:#{column}).serialization_column
send(:"\#{column}_changed?")
end
+
+ def find_previous_model_for_#{column}
+ if self.embedded?
+ self._parent.reload.send(self.metadata.key).find(to_key.first)
+ else
+ self.class.find(to_key.first)
+ end
+ end
+
RUBY
end
end # Mongoid
end # CarrierWave