Sha256: eb8d297383d6ef8f405b4e2a2b8267b7fd33750819e48ad4c2c0844b50f49fe6

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module MongoMapper
  module Utils
    def self.get_safe_options(options)
      return {} unless options and options.key? :safe
      safe = options[:safe]
      safe = {:w => 1} if safe == true
      safe = {:w => 0} if safe == false
      safe = {:w => safe} if safe.is_a? Integer
      safe
    end

    def self.filter_param(name, raw_value)
      if ActiveSupport.version >= Gem::Version.new("6.0")
        @filter ||= begin
          require "active_support/parameter_filter"
          ActiveSupport::ParameterFilter.new(MongoMapper.filter_attributes)
        end
        @filter.filter_param(name, raw_value)
      else
        raw_value
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 lib/mongo_mapper/utils.rb