Sha256: 7d2358c60b2a488fe44d0712995ffd85abe10a4afe4eb74464b2f73c2dbf4f06

Contents?: true

Size: 796 Bytes

Versions: 42

Compression:

Stored size: 796 Bytes

Contents

module ActiveGraph::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

42 entries across 42 versions & 1 rubygems

Version Path
activegraph-12.0.0.beta.4 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.5.0.beta.3 lib/active_graph/shared/permitted_attributes.rb
activegraph-12.0.0.beta.3 lib/active_graph/shared/permitted_attributes.rb
activegraph-12.0.0.beta.2 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.5.0.beta.2 lib/active_graph/shared/permitted_attributes.rb
activegraph-12.0.0.beta.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.5.0.beta.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.5.0.alpha.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.4.0 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.3.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.3.0 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.2.0 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.1.0 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.1.0.beta.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.1.0.alpha.4 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.1.0.alpha.3 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.1.0.alpha.2 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.1.0.alpha.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.2.0.beta.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.2-java lib/active_graph/shared/permitted_attributes.rb