Class: SpreeCmCommissioner::Exports::ExportGuestCsv
- Inherits:
-
SpreeCmCommissioner::Export
- Object
- Spree::Base
- Base
- SpreeCmCommissioner::Export
- SpreeCmCommissioner::Exports::ExportGuestCsv
- Defined in:
- app/models/spree_cm_commissioner/exports/export_guest_csv.rb
Instance Method Summary collapse
Methods inherited from SpreeCmCommissioner::Export
Instance Method Details
#construct_header ⇒ Object
7 8 9 |
# File 'app/models/spree_cm_commissioner/exports/export_guest_csv.rb', line 7 def construct_header SpreeCmCommissioner::Guest.column_names.map(&:titleize) end |
#construct_row(guest) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/spree_cm_commissioner/exports/export_guest_csv.rb', line 11 def construct_row(guest) guest.attributes.map do |key, value| case key when 'dob' value&.strftime('%d %b %Y') when 'event_id' guest.event&.name when 'nationality_id' guest.nationality&.name when 'occupation_id' guest.occupation&.name else value end end end |
#scope ⇒ Object
28 29 30 |
# File 'app/models/spree_cm_commissioner/exports/export_guest_csv.rb', line 28 def scope SpreeCmCommissioner::Guest.where(event_id: preferred_event_id) end |