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-10.1.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.1-java lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.0-java lib/active_graph/shared/permitted_attributes.rb
activegraph-10.1.0 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.0.beta.4-java lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.2 lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.0.beta.3-java lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.0.beta.2-java lib/active_graph/shared/permitted_attributes.rb
activegraph-11.0.0.beta.1-java lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.1 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.11 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.10 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.9 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.8 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.7 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.6 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.5 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.4 lib/active_graph/shared/permitted_attributes.rb
activegraph-10.0.0.pre.beta.3 lib/active_graph/shared/permitted_attributes.rb