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
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
16 17 18 |
# File 'app/models/renalware/events/event.rb', line 16 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
30 31 32 |
# File 'app/models/renalware/events/event.rb', line 30 def document NullObject.instance end |
#partial_for(partial_type) ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/models/renalware/events/event.rb', line 53 def partial_for(partial_type) File.join( "renalware/events/events", partial_type, self.class.name.demodulize.underscore ) end |
#to_cell_partial_path ⇒ Object
45 46 47 |
# File 'app/models/renalware/events/event.rb', line 45 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.
40 41 42 |
# File 'app/models/renalware/events/event.rb', line 40 def to_partial_path partial_for "inputs" end |
#to_s ⇒ Object
34 35 36 |
# File 'app/models/renalware/events/event.rb', line 34 def to_s description end |
#to_toggled_cell_partial_path ⇒ Object
49 50 51 |
# File 'app/models/renalware/events/event.rb', line 49 def to_toggled_cell_partial_path partial_for "toggled_cell" end |