Module: Shrine::Plugins::Mongoid::AttacherMethods
- Defined in:
- lib/shrine/plugins/mongoid.rb
Instance Method Summary collapse
-
#swap(uploaded_file) ⇒ Object
Updates the current attachment with the new one, unless the current attachment has changed.
Instance Method Details
#swap(uploaded_file) ⇒ Object
Updates the current attachment with the new one, unless the current attachment has changed.
55 56 57 58 59 |
# File 'lib/shrine/plugins/mongoid.rb', line 55 def swap(uploaded_file) return if record.send(:"#{name}_data") != record.reload.send(:"#{name}_data") super rescue ::Mongoid::Errors::DocumentNotFound end |