Module: Filthy::InstanceMethods
- Defined in:
- lib/filthy.rb
Instance Method Summary collapse
- #clean_filthy_attributes ⇒ Object
- #has_filthy_attributes? ⇒ Boolean
- #set_filthy_before_save ⇒ Object
Instance Method Details
#clean_filthy_attributes ⇒ Object
43 44 45 |
# File 'lib/filthy.rb', line 43 def clean_filthy_attributes self.class.filthy_attribute_methods.each { |fa| send("#{fa}=", nil) } end |
#has_filthy_attributes? ⇒ Boolean
31 32 33 |
# File 'lib/filthy.rb', line 31 def has_filthy_attributes? defined?(filthy_columns) and self.filthy_columns.present? end |
#set_filthy_before_save ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/filthy.rb', line 35 def set_filthy_before_save clean_filthy_attributes filthy_attributes = changes.keys.select { |attribute| self.class.filthy_columns.include? attribute.to_sym } filthy_attributes.each do |filthy_attribute| send("#{filthy_attribute}_filthy=", true) end end |