2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2017-09-05 22:23:34 +03:00
|
|
|
class Contact < ApplicationRecord
|
2016-05-24 23:54:46 +05:30
|
|
|
has_paper_trail on: [:update], ignore: [:updated_at], meta: { conference_id: :conference_id }
|
|
|
|
|
|
2014-07-31 18:49:46 +02:00
|
|
|
belongs_to :conference
|
|
|
|
|
|
|
|
|
|
validates :conference, presence: true
|
|
|
|
|
# Conferences only have one contact
|
2017-12-01 20:40:46 +01:00
|
|
|
validates :facebook, :twitter, :googleplus, :instagram, :mastodon,
|
2014-07-31 20:09:38 +02:00
|
|
|
format: URI::regexp(%w(http https)), allow_blank: true
|
2014-11-21 13:22:20 +01:00
|
|
|
|
|
|
|
|
def has_social_media?
|
2017-12-01 20:40:46 +01:00
|
|
|
return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || mastodon.present? || email.present?
|
2018-11-13 18:01:49 -08:00
|
|
|
|
2014-11-21 13:22:20 +01:00
|
|
|
false
|
|
|
|
|
end
|
2014-07-31 18:49:46 +02:00
|
|
|
end
|