Sha256: b7866ee7c2fc398a02f0279c9901d40efc22cb621be9e8608814c3bb845ca7a6

Contents?: true

Size: 323 Bytes

Versions: 10

Compression:

Stored size: 323 Bytes

Contents

module Contacts
  extend ActiveSupport::Concern

  included do
    has_many :contacts, as: :contactable

    def get_primary_contact
      contacts.where(primary: true).first
    end

    def contact_widget
      "#{get_primary_contact.contact_type}: #{get_primary_contact.data}" if get_primary_contact
    end
  end

end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
gaku-0.1.1 core/app/models/concerns/contacts.rb
gaku_core-0.1.1 app/models/concerns/contacts.rb
gaku-0.1.0 core/app/models/concerns/contacts.rb
gaku_core-0.1.0 app/models/concerns/contacts.rb
gaku_core-0.0.3 app/models/concerns/contacts.rb
gaku-0.0.3 core/app/models/concerns/contacts.rb
gaku-0.0.2 core/app/models/concerns/contacts.rb
gaku_core-0.0.2 app/models/concerns/contacts.rb
gaku-0.0.1 core/app/models/concerns/contacts.rb
gaku_core-0.0.1 app/models/concerns/contacts.rb