Module: Dunlop::WorkflowStepModel::NotesHandling

Extended by:
ActiveSupport::Concern
Defined in:
app/models/dunlop/workflow_step_model/notes_handling.rb

Instance Method Summary collapse

Instance Method Details

#append_note(value) ⇒ Object



10
11
12
# File 'app/models/dunlop/workflow_step_model/notes_handling.rb', line 10

def append_note(value)
  write_attribute :notes, [notes, value].join("\n")
end

#notes=(append_text) ⇒ Object



4
5
6
7
8
# File 'app/models/dunlop/workflow_step_model/notes_handling.rb', line 4

def notes=(append_text)
  change_time = attribute_change_time || Time.current
  write_attribute :notes,
    "#{notes}\n\n#{change_time.iso8601} #{User.current.try(:email)}\n#{append_text}".strip
end

#replace_notes(value) ⇒ Object Also known as: replace_notes=



14
15
16
# File 'app/models/dunlop/workflow_step_model/notes_handling.rb', line 14

def replace_notes(value)
  write_attribute :notes, value
end

#replace_notes!(value) ⇒ Object



19
20
21
22
# File 'app/models/dunlop/workflow_step_model/notes_handling.rb', line 19

def replace_notes!(value)
  replace_notes value
  save
end