module UserActionsLogger

Public Instance Methods

watch_for() click to toggle source
# File lib/user_actions_logger.rb, line 13
def watch_for
  'override this method(watch_for) in you controller. Read the doc!'
end
what_did() click to toggle source
# File lib/user_actions_logger.rb, line 25
def what_did
  params[:action]
end
where_did() click to toggle source
# File lib/user_actions_logger.rb, line 21
def where_did
  controller_name.classify
end
who_did_it() click to toggle source
# File lib/user_actions_logger.rb, line 17
def who_did_it
  current_user.to_json
end

Private Instance Methods

create_log() click to toggle source
# File lib/user_actions_logger.rb, line 31
def create_log
  log = Logging.new
  log.user = who_did_it
  log.object = watch_for.to_json
  log.action = what_did
  log.loggable_type = where_did
  log.loggable_id = watch_for.id
  log.save
end