osem-fcy/app/models/contact.rb

19 lines
589 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Contact < ApplicationRecord
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,
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