Module: Rsvp::SalutationMixin
- Extended by:
- ActiveSupport::Concern
- Included in:
- Family, Invitation
- Defined in:
- app/models/rsvp/salutation_mixin.rb
Instance Method Summary collapse
Instance Method Details
#generate_salutation ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/models/rsvp/salutation_mixin.rb', line 19 def generate_salutation salutation = read_attribute(:salutation) if salutation.blank? && salutation_type.present? begin write_attribute(:salutation, salutation_type.try(:new, family).to_s) self.save(callbacks: false) rescue # Trap exceptions thrown due to incomplete data structures end end end |
#salutation_type ⇒ Object
15 16 17 |
# File 'app/models/rsvp/salutation_mixin.rb', line 15 def salutation_type read_attribute(:salutation_type).try(:constantize) end |
#salutation_type=(klass) ⇒ Object
11 12 13 |
# File 'app/models/rsvp/salutation_mixin.rb', line 11 def salutation_type=(klass) write_attribute(:salutation_type, klass.to_s) end |