Class: Renalware::Events::Event
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Renalware::Events::Event
- Includes:
- Accountable, PatientScope
- Defined in:
- app/models/renalware/events/event.rb
Direct Known Subclasses
AdvancedCarePlan, Biopsy, ClinicalFrailtyScore, Investigation, Simple, Swab, Virology::Vaccination
Instance Attribute Summary collapse
-
#disable_selection_of_event_type ⇒ Object
Virtual attribute helps us persist in the UI (across posts) whether or not the event_type can be changed.
Instance Method Summary collapse
-
#document ⇒ Object
By default an event has no embedded document but a subclass may implement one using has_document.
- #partial_for(partial_type) ⇒ Object
- #to_cell_partial_path ⇒ Object
-
#to_partial_path ⇒ Object
(also: #to_input_partial_path)
As Events are a cross domain model, a subclass can choose to override to_partial_path etc in order to use events from another namespace for instance.
- #to_s ⇒ Object
- #to_toggled_cell_partial_path ⇒ Object
Methods included from Accountable
#first_or_create_by!, #save_by, #save_by!, #update_by
Instance Attribute Details
#disable_selection_of_event_type ⇒ Object
Virtual attribute helps us persist in the UI (across posts) whether or not the event_type can be changed. If we target e.g.
patient_new_specific_event(slug: 'something')
it can be assumed we are creating an event of a certain type (event_type.slug == ‘something’) and therefore changing that type in the new event form should be disallowed
17 18 19 |
# File 'app/models/renalware/events/event.rb', line 17 def disable_selection_of_event_type @disable_selection_of_event_type end |
Instance Method Details
#document ⇒ Object
By default an event has no embedded document but a subclass may implement one using has_document
33 34 35 |
# File 'app/models/renalware/events/event.rb', line 33 def document NullObject.instance end |
#partial_for(partial_type) ⇒ Object
56 57 58 59 60 61 62 |
# File 'app/models/renalware/events/event.rb', line 56 def partial_for(partial_type) File.join( "renalware/events/events", partial_type, self.class.name.demodulize.underscore ) end |
#to_cell_partial_path ⇒ Object
48 49 50 |
# File 'app/models/renalware/events/event.rb', line 48 def to_cell_partial_path partial_for "cell" end |
#to_partial_path ⇒ Object Also known as: to_input_partial_path
As Events are a cross domain model, a subclass can choose to override to_partial_path etc in order to use events from another namespace for instance.
43 44 45 |
# File 'app/models/renalware/events/event.rb', line 43 def to_partial_path partial_for "inputs" end |
#to_s ⇒ Object
37 38 39 |
# File 'app/models/renalware/events/event.rb', line 37 def to_s description end |
#to_toggled_cell_partial_path ⇒ Object
52 53 54 |
# File 'app/models/renalware/events/event.rb', line 52 def to_toggled_cell_partial_path partial_for "toggled_cell" end |