Sha256: f382d8b26eeeee641a64c460c17b3df882775598d4720044e08bff358aac89a3

Contents?: true

Size: 651 Bytes

Versions: 6

Compression:

Stored size: 651 Bytes

Contents

module ActiveRecord
  module MassAssignmentSecurity
    module Inheritance
      extend ActiveSupport::Concern

      module ClassMethods
      private
        # Detect the subclass from the inheritance column of attrs. If the inheritance column value
        # is not self or a valid subclass, raises ActiveRecord::SubclassNotFound
        # If this is a StrongParameters hash, and access to inheritance_column is not permitted,
        # this will ignore the inheritance column and return nil
        def subclass_from_attrs(attrs)
          active_authorizer[:default].deny?(inheritance_column) ? nil : super
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
protected_attributes-1.0.5 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.4 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.3 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.2 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.1 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.0 lib/active_record/mass_assignment_security/inheritance.rb