module PermittedAttributes::ClassMethods
Constants
- DEFAULT_EXCLUDED_ATTRIBUTES
Public Instance Methods
excluded_attributes(*attrs, skip_defaults: false)
click to toggle source
# File lib/permitted_attributes/permitted_attributes.rb, line 13 def excluded_attributes(*attrs, skip_defaults: false) @excluded_attributes = *attrs @skip_defaults = skip_defaults end
permitted_attributes()
click to toggle source
# File lib/permitted_attributes/permitted_attributes.rb, line 7 def permitted_attributes return [] unless respond_to?(:column_names) (column_names || []).map(&:to_sym) - attributes_to_exclude end
Private Instance Methods
attributes_to_exclude()
click to toggle source
# File lib/permitted_attributes/permitted_attributes.rb, line 22 def attributes_to_exclude @excluded_attributes ||= [] results = if @skip_defaults @excluded_attributes else @excluded_attributes + DEFAULT_EXCLUDED_ATTRIBUTES end results.uniq end