Sha256: 85c7e42f6a9ec0b39a9b1f41aa16fbd80e7e47ad57b5b4c13e854913accc264a

Contents?: true

Size: 496 Bytes

Versions: 6

Compression:

Stored size: 496 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    module Safe
      extend ActiveSupport::Concern

      module ClassMethods
        def inherited(subclass)
          super
          subclass.safe if safe?
        end

        def safe
          @safe = true
        end

        def safe?
          @safe == true
        end
      end

      def save_to_collection(options={})
        options[:safe] = self.class.safe? unless options.key?(:safe)
        super
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
mongo_mapper-0.12.0 lib/mongo_mapper/plugins/safe.rb
lookout-mongo_mapper-0.11.3 lib/mongo_mapper/plugins/safe.rb
mongo_mapper-0.11.2 lib/mongo_mapper/plugins/safe.rb
jamieorc-mongo_mapper-0.11.1.1 lib/mongo_mapper/plugins/safe.rb
mongo_mapper-0.11.1 lib/mongo_mapper/plugins/safe.rb
mongo_mapper-0.11.0 lib/mongo_mapper/plugins/safe.rb