osem-fcy/app/models/contact.rb
Ana 7e5d20c89d style: if ! changed by unless
- if ! changed by unless as it is more readable
- !object.blank? is equivalent to object.present?, also more readable
2016-08-06 00:57:07 +02:00

13 lines
429 B
Ruby

class Contact < ActiveRecord::Base
belongs_to :conference
validates :conference, presence: true
# Conferences only have one contact
validates :facebook, :twitter, :googleplus, :instagram,
format: URI::regexp(%w(http https)), allow_blank: true
def has_social_media?
return true if facebook.present? || twitter.present? || googleplus.present? || instagram.present? || email.present?
false
end
end