Sha256: baf61b34124604d4ffae663477e959805f5500b352e850fce98eb0c3eff18f27

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

module MongoMapper
  module Plugins
    module StrongParameters
      extend ::ActiveSupport::Concern

      included do
        include ::ActiveModel::ForbiddenAttributesProtection
        class << self
          if ::ActiveSupport.version >= Gem::Version.new("7.1")
            deprecate :attr_protected, :attr_accessible, deprecator: ::MongoMapper.deprecator
          else
            deprecate :attr_protected, :attr_accessible
          end
        end
      end

      def attributes=(attrs = {})
        super sanitize_for_mass_assignment(attrs)
      end

      def update_attributes(attrs = {})
        super sanitize_for_mass_assignment(attrs)
      end

      def update_attributes!(attrs = {})
        super sanitize_for_mass_assignment(attrs)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongo_mapper-0.17.0 lib/mongo_mapper/plugins/strong_parameters.rb
mongo_mapper-0.16.0 lib/mongo_mapper/plugins/strong_parameters.rb