Module: LogBook::ControllerRecord

Extended by:
ActiveSupport::Concern
Defined in:
lib/log_book/controller_record.rb

Instance Method Summary collapse

Instance Method Details

#current_authorObject

Raises:

  • (NotImplementedError)


22
23
24
25
26
# File 'lib/log_book/controller_record.rb', line 22

def current_author
  raise NotImplementedError unless respond_to?(LogBook.config.author_method, true)

  send(LogBook.config.author_method)
end

#enable_recordingObject



10
11
12
13
14
15
16
# File 'lib/log_book/controller_record.rb', line 10

def enable_recording
  action = "#{controller_name}##{action_name}"
  author = current_author
  request_uuid = try(:request).try(:uuid) || SecureRandom.hex
  LogBook::Store.tree = LogBook::Tree.new(action: action, author: author, request_uuid: request_uuid)
  LogBook.enable_recording
end

#save_recordsObject



18
19
20
# File 'lib/log_book/controller_record.rb', line 18

def save_records
  LogBook::SaveRecords.call
end