Sha256: 63f9adc27de7c50c5ba62cddee686b153e56710bbdf42cb31b1d9c9197d00f2f

Contents?: true

Size: 867 Bytes

Versions: 13

Compression:

Stored size: 867 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_attributes?(attrs)
          active_authorizer[:default].deny?(inheritance_column) ? nil : super
        end

        # Support Active Record <= 4.0.3, which uses the old method signature.
        def subclass_from_attrs(attrs)
          active_authorizer[:default].deny?(inheritance_column) ? nil : super
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
protected_attributes-1.1.4 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes_continued-1.2.4 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes_continued-1.2.3 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes_continued-1.2.2 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes_continued-1.2.1 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes_continued-1.2.0 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.1.3 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.1.2 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.1.1 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.1.0 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.9 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.8 lib/active_record/mass_assignment_security/inheritance.rb
protected_attributes-1.0.7 lib/active_record/mass_assignment_security/inheritance.rb