Class: Renalware::Letters::UnreadElectronicCCsComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Renalware::Letters::UnreadElectronicCCsComponent
- Includes:
- Pundit::Helper
- Defined in:
- app/components/renalware/letters/unread_electronic_ccs_component.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
Instance Method Summary collapse
-
#initialize(current_user:) ⇒ UnreadElectronicCCsComponent
constructor
A new instance of UnreadElectronicCCsComponent.
- #unread_electronic_ccs ⇒ Object
Methods inherited from ApplicationComponent
Constructor Details
#initialize(current_user:) ⇒ UnreadElectronicCCsComponent
Returns a new instance of UnreadElectronicCCsComponent.
9 10 11 |
# File 'app/components/renalware/letters/unread_electronic_ccs_component.rb', line 9 def initialize(current_user:) @current_user = current_user end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
7 8 9 |
# File 'app/components/renalware/letters/unread_electronic_ccs_component.rb', line 7 def current_user @current_user end |
Instance Method Details
#unread_electronic_ccs ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/renalware/letters/unread_electronic_ccs_component.rb', line 13 def unread_electronic_ccs @unread_electronic_ccs ||= begin receipts = Letters::ElectronicReceipt .includes(letter: [:patient, :author, :letterhead]) .unread .for_recipient(current_user.id) .order(created_at: :asc) CollectionPresenter.new(receipts, Letters::ElectronicReceiptPresenter) end end |