Module: LogBook::Recorder::RecordingInstanceMethods

Defined in:
lib/log_book/recorder.rb

Instance Method Summary collapse

Instance Method Details

#new_recordObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/log_book/recorder.rb', line 36

def new_record
  record = LogBook::Record.new(
    action: LogBook.store[:action],
    record_changes: record_changes,
    author: LogBook.store[:author],
    subject: self,
    meta: {}
  )
  record.meta = log_book_meta_info(record) if recording_options[:meta].present?
  record.parent = send(recording_options[:parent]) if recording_options[:parent].present?
  record
end

#non_recording_columnsObject



53
54
55
# File 'lib/log_book/recorder.rb', line 53

def non_recording_columns
  self.class.non_recording_columns
end

#recording_attributesObject



49
50
51
# File 'lib/log_book/recorder.rb', line 49

def recording_attributes
  attributes.except(*non_recording_columns)
end

#save_with_recordingObject



28
29
30
# File 'lib/log_book/recorder.rb', line 28

def save_with_recording
  with_recording { save }
end

#to_squash?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/log_book/recorder.rb', line 24

def to_squash?
  recording_options[:squash]
end

#with_recording(&block) ⇒ Object



32
33
34
# File 'lib/log_book/recorder.rb', line 32

def with_recording(&block)
  self.class.with_recording(&block)
end