Class: Renalware::Patients::BookmarksComponent

Inherits:
ApplicationComponent show all
Defined in:
app/components/renalware/patients/bookmarks_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#policy, #renalware

Constructor Details

#initialize(current_user:) ⇒ BookmarksComponent

Returns a new instance of BookmarksComponent.



8
9
10
# File 'app/components/renalware/patients/bookmarks_component.rb', line 8

def initialize(current_user:)
  @current_user = current_user
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



6
7
8
# File 'app/components/renalware/patients/bookmarks_component.rb', line 6

def current_user
  @current_user
end

Instance Method Details

#bookmarksObject



12
13
14
15
16
17
18
19
# File 'app/components/renalware/patients/bookmarks_component.rb', line 12

def bookmarks
  @bookmarks ||= begin
    Patients.cast_user(current_user)
      .bookmarks
      .ordered
      .includes(patient: [current_modality: :description])
  end
end