Module: GBDev::CallbackLogger::ClassMethods

Defined in:
lib/callback_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aacl_modelObject

Returns the value of attribute aacl_model.



11
12
13
# File 'lib/callback_logger.rb', line 11

def aacl_model
  @aacl_model
end

#callback_logger_text_attrObject

Returns the value of attribute callback_logger_text_attr.



11
12
13
# File 'lib/callback_logger.rb', line 11

def callback_logger_text_attr
  @callback_logger_text_attr
end

Instance Method Details

#log_callbacks(new_options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/callback_logger.rb', line 13

def log_callbacks(new_options = {}) 
  options = {:aacl_model => 'AppLog'}
  options.merge!(new_options)
  
  mod = options[:aacl_model].titleize.gsub(' ','')
  mod = ActiveSupport::Inflector.camelize(mod).constantize
  self.aacl_model = mod
  
  self.callback_logger_text_attr = options[:text].to_sym if options.has_key?(:text)
                                      
  extend GBDev::CallbackLogger::SingletonMethods
  include GBDev::CallbackLogger::InstanceMethods
  
  class_eval do          
    after_create :log_create
    after_update :log_update
    after_destroy :log_destroy
  end # class_eval        
end