Class: Renalware::Problems::Problem

Inherits:
ApplicationRecord show all
Includes:
Accountable, Renalware::PatientScope
Defined in:
app/models/renalware/problems/problem.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Accountable

#first_or_create_by!, #save_by, #save_by!, #update_by

Class Method Details

.archivedObject



32
33
34
# File 'app/models/renalware/problems/problem.rb', line 32

def self.archived
  only_deleted.with_notes
end

.currentObject



28
29
30
# File 'app/models/renalware/problems/problem.rb', line 28

def self.current
  all.with_notes
end

.reject_if_procObject



56
57
58
# File 'app/models/renalware/problems/problem.rb', line 56

def self.reject_if_proc
  proc { |attrs| attrs[:description].blank? }
end

.with_archivedObject



24
25
26
# File 'app/models/renalware/problems/problem.rb', line 24

def self.with_archived
  with_deleted
end

Instance Method Details

#archived?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'app/models/renalware/problems/problem.rb', line 36

def archived?
  deleted?
end

#archived_atObject



40
41
42
# File 'app/models/renalware/problems/problem.rb', line 40

def archived_at
  deleted_at
end

#archived_onObject



44
45
46
# File 'app/models/renalware/problems/problem.rb', line 44

def archived_on
  deleted_at.to_date
end

#created_onObject



48
49
50
# File 'app/models/renalware/problems/problem.rb', line 48

def created_on
  created_at.to_date
end

#formattedObject



64
65
66
# File 'app/models/renalware/problems/problem.rb', line 64

def formatted
  "#{full_description}, #{date}"
end

#full_descriptionObject



60
61
62
# File 'app/models/renalware/problems/problem.rb', line 60

def full_description
  description
end

#updated_onObject



52
53
54
# File 'app/models/renalware/problems/problem.rb', line 52

def updated_on
  updated_at.to_date
end