Sha256: 8785b840586ebfc8d33fa9d1b58cf47ec1ca289b253c6fe7a6a58bbe294ff06b

Contents?: true

Size: 790 Bytes

Versions: 96

Compression:

Stored size: 790 Bytes

Contents

module Neo4j::Shared
  module PermittedAttributes
    extend ActiveSupport::Concern
    include ActiveModel::ForbiddenAttributesProtection

    def process_attributes(attributes)
      attributes = sanitize_input_parameters(attributes)
      super(attributes)
    end

    def attributes=(attributes)
      attributes = sanitize_input_parameters(attributes)
      super(attributes)
    end

    protected

    # Check if an argument is a string or an ActionController::Parameters
    def hash_or_parameter?(args)
      args.is_a?(Hash) || args.respond_to?(:to_unsafe_h)
    end

    def sanitize_input_parameters(attributes)
      attributes = sanitize_for_mass_assignment(attributes)
      attributes.respond_to?(:symbolize_keys) ? attributes.symbolize_keys : attributes
    end
  end
end

Version data entries

96 entries across 96 versions & 3 rubygems

Version Path
neo4j-9.2.3 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.2.2 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.2.1 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.2.0 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.8 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.7 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.6 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.5 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.4 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.3 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.2 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.1 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.1.0 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.0.7 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.0.6 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.0.5 lib/neo4j/shared/permitted_attributes.rb
neo4j-8.3.4 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.0.4 lib/neo4j/shared/permitted_attributes.rb
neo4j-8.3.3 lib/neo4j/shared/permitted_attributes.rb
neo4j-9.0.3 lib/neo4j/shared/permitted_attributes.rb