Class: Renalware::Letters::ContactsPresenter

Inherits:
CollectionPresenter show all
Defined in:
app/presenters/renalware/letters/contacts_presenter.rb

Instance Method Summary collapse

Methods inherited from CollectionPresenter

#initialize, #method_missing, #respond_to?, #to_a, #to_ary, #to_json

Constructor Details

This class inherits a constructor from CollectionPresenter

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CollectionPresenter

Instance Method Details

#array_for_drop_down_with_optionsObject

An array of contacts for use in a simple_form drop down. The data-salutation is added (the final hash argument very kindly merges * onto the <option> so we could add other options here too.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/presenters/renalware/letters/contacts_presenter.rb', line 12

def array_for_drop_down_with_options
  map do |contact|
    [
      contact.name_and_description,
      contact.id,
      {
        data: {
          salutation: contact.salutation,
          class: ".has_salutation"
        }
      }
    ]
  end
end