Module: DynamicActiveModel::DangerousAttributesPatch

Defined in:
lib/dynamic-active-model/dangerous_attributes_patch.rb

Overview

DynamicActiveModel::DangerousAttributesPatch is used to remove dangerous attribute names from attribute_names method in ActiveRecord

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
# File 'lib/dynamic-active-model/dangerous_attributes_patch.rb', line 7

def self.included(base)
  if base.attribute_names
    columns_to_ignore = base.attribute_names.select { |name| base.dangerous_attribute_method?(name) }
    base.ignored_columns = columns_to_ignore
  end
end