osem-fcy/app/models/contact.rb
Carlos Coelho 483d9a234e Verified contact has email or not
issue #764

Signed-off-by: Carlos Coelho <carlos@pencillabs.com>
2016-03-07 09:43:55 -03:00

15 lines
506 B
Ruby

class Contact < ActiveRecord::Base
belongs_to :conference
validates :conference, presence: true
# Conferences only have one contact
validates :conference_id, uniqueness: {message: 'has already contact details'}
validates :facebook, :twitter, :googleplus, :instagram,
format: URI::regexp(%w(http https)), allow_blank: true
def has_social_media?
return true if !facebook.blank? || !twitter.blank? || !googleplus.blank? || !instagram.blank? || !email.blank?
false
end
end