2014-07-31 18:49:46 +02:00
|
|
|
class Contact < ActiveRecord::Base
|
2014-09-30 11:59:02 +02:00
|
|
|
attr_accessible :conference_id, :social_tag, :email, :facebook, :googleplus, :twitter,
|
|
|
|
|
:instagram, :public, :sponsor_email
|
|
|
|
|
|
2014-07-31 18:49:46 +02:00
|
|
|
belongs_to :conference
|
|
|
|
|
|
|
|
|
|
validates :conference, presence: true
|
|
|
|
|
# Conferences only have one contact
|
2014-08-18 21:54:43 +03:00
|
|
|
validates :conference_id, uniqueness: {message: 'has already contact details'}
|
2014-07-31 20:09:38 +02:00
|
|
|
|
|
|
|
|
validates :facebook, :twitter, :googleplus, :instagram,
|
|
|
|
|
format: URI::regexp(%w(http https)), allow_blank: true
|
2014-11-21 13:22:20 +01:00
|
|
|
|
|
|
|
|
def has_social_media?
|
|
|
|
|
return true if !facebook.blank? || !twitter.blank? || !googleplus.blank? || !instagram.blank?
|
|
|
|
|
false
|
|
|
|
|
end
|
2014-07-31 18:49:46 +02:00
|
|
|
end
|