Module: Omelettes::ModelAdditions
- Defined in:
- lib/omelettes/model_additions.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
41 42 43 |
# File 'lib/omelettes/model_additions.rb', line 41 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#obfuscate(column_names) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/omelettes/model_additions.rb', line 26 def obfuscate(column_names) attributes = {} column_names.each do |column_name| column = self.class.column_config(column_name) original_value = self.send(column_name) if column value = column.process(original_value) else value = Column.default(column_name, original_value) end attributes[column_name] = value end self.class.where(:id => self.id).update_all(attributes) end |