Sha256: 000aad55a4283342091aa57c4655564d317334b4dc83d38c15e742302021fad8

Contents?: true

Size: 397 Bytes

Versions: 6

Compression:

Stored size: 397 Bytes

Contents

require "active_model/forbidden_attributes_protection"

module MongoModel
  module AttributeMethods
    module Forbidden
      extend ActiveSupport::Concern
      
      def assign_attributes(attrs, options={})
        if attrs.respond_to?(:permitted?) && !attrs.permitted?
          raise ActiveModel::ForbiddenAttributesError
        else
          super
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mongomodel-0.5.5 lib/mongomodel/concerns/attribute_methods/forbidden.rb
mongomodel-0.5.4 lib/mongomodel/concerns/attribute_methods/forbidden.rb
mongomodel-0.5.3 lib/mongomodel/concerns/attribute_methods/forbidden.rb
mongomodel-0.5.2 lib/mongomodel/concerns/attribute_methods/forbidden.rb
mongomodel-0.5.1 lib/mongomodel/concerns/attribute_methods/forbidden.rb
mongomodel-0.5.0 lib/mongomodel/concerns/attribute_methods/forbidden.rb