Class: Renalware::Medications::Prescription
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#first_or_create_by!, #save_by, #save_by!, #update_by
Instance Attribute Details
#drug_select ⇒ Object
Returns the value of attribute drug_select.
11
12
13
|
# File 'app/models/renalware/medications/prescription.rb', line 11
def drug_select
@drug_select
end
|
Class Method Details
.default_search_order ⇒ Object
This is a Ransack-compatible search predicate
79
80
81
|
# File 'app/models/renalware/medications/prescription.rb', line 79
def self.default_search_order
"drug_name"
end
|
.policy_class ⇒ Object
83
84
85
|
# File 'app/models/renalware/medications/prescription.rb', line 83
def self.policy_class
BasePolicy
end
|
Instance Method Details
#current?(date = Date.current) ⇒ Boolean
98
99
100
|
# File 'app/models/renalware/medications/prescription.rb', line 98
def current?(date = Date.current)
terminated_on.nil? || terminated_on >= date
end
|
#terminate(by:, terminated_on: Date.current) ⇒ Object
109
110
111
|
# File 'app/models/renalware/medications/prescription.rb', line 109
def terminate(by:, terminated_on: Date.current)
build_termination(by: by, terminated_on: terminated_on)
end
|
#terminated_by ⇒ Object
89
90
91
92
93
|
# File 'app/models/renalware/medications/prescription.rb', line 89
def terminated_by
return unless terminated_or_marked_for_termination?
termination.created_by
end
|
#terminated_or_marked_for_termination? ⇒ Boolean
102
103
104
|
# File 'app/models/renalware/medications/prescription.rb', line 102
def terminated_or_marked_for_termination?
terminated_on.present?
end
|