Module: GBDev::CallbackLogger::InstanceMethods
- Defined in:
- lib/callback_logger.rb
Overview
SingletonMethods
Instance Method Summary collapse
Instance Method Details
#log_create ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/callback_logger.rb', line 43 def log_create data = "id||#{self.id}||#{self.id}|" class_name = self.class.to_s.titleize.downcase msg = "Created #{class_name} (#{text_to_display})" self.class.callback_logger_model.create({:msg => msg, :data => data, :model => self.class.to_s}) rescue Exception => msg # Just fail quietly end |
#log_destroy ⇒ Object
63 64 65 66 67 68 69 70 71 |
# File 'lib/callback_logger.rb', line 63 def log_destroy data = self.attributes.keys.collect{ |key| "#{key}||#{self.attributes[key]}" }.join('|::|') class_name = self.class.to_s.titleize.downcase msg = "Deleted #{class_name} (#{text_to_display})" self.class.callback_logger_model.create({:msg => msg, :data => data, :model => self.class.to_s}) rescue Exception => msg # Just fail quietly end |
#log_update ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/callback_logger.rb', line 52 def log_update data = self.changes.keys.collect{ |key| "#{key}||#{self.changes[key][0]}||#{self.changes[key][1]}" }.join('|::|') data = "id||#{self.id}||#{self.id}|::|#{data}" unless data.empty? class_name = self.class.to_s.titleize.downcase msg = "Updated #{class_name} (#{text_to_display})" self.class.callback_logger_model.create({:msg => msg, :data => data, :model => self.class.to_s}) unless data.empty? rescue Exception => msg # Just fail quietly end |