PerfectlyNormal/mm-nested-attributes

View on GitHub
lib/mongo_mapper/plugins/associations/nested_attributes/extensions/belongs_to_proxy.rb

Summary

Maintainability
A
0 mins
Test Coverage
module MongoMapper
  module Plugins
    module Associations

      class BelongsToProxy
        def save_to_collection(options={})
          if @target
            if @target.marked_for_destruction?
              @target.destroy
            else
              @target.save(options)
            end
          end
        end
      end

    end
  end
end