Module: ActsAsReplaceable::HelperMethods

Defined in:
lib/acts_as_replaceable/acts_as_replaceable.rb

Class Method Summary collapse

Class Method Details

.sanitize_attribute_names(klass, *args) ⇒ Object



26
27
28
29
# File 'lib/acts_as_replaceable/acts_as_replaceable.rb', line 26

def self.sanitize_attribute_names(klass, *args)
  # Intersect the proposed attributes with the column names so we don't start assigning attributes that don't exist. e.g. if the model doesn't have timestamps
  klass.column_names & args.flatten.compact.collect(&:to_s)
end