Sha256: 3797ce4b01ae5f38fb825e76bb6a6799715777e0557926198e7995a9d21d5c55
Contents?: true
Size: 1.48 KB
Versions: 11
Compression:
Stored size: 1.48 KB
Contents
module SocialNetworking module Concerns # adds associations to Participant class module Participant extend ActiveSupport::Concern included do has_many :social_networking_comments, class_name: "SocialNetworking::Comment", dependent: :destroy has_many :social_networking_goals, class_name: "SocialNetworking::Goal", dependent: :destroy has_many :social_networking_likes, class_name: "SocialNetworking::Like", dependent: :destroy has_many :initiator_nudges, foreign_key: :initiator_id, class_name: "SocialNetworking::Nudge", dependent: :destroy has_many :recipient_nudges, foreign_key: :recipient_id, class_name: "SocialNetworking::Nudge", dependent: :destroy has_many :social_networking_on_the_mind_statements, class_name: "SocialNetworking::OnTheMindStatement", dependent: :destroy has_one :social_networking_profile, class_name: "SocialNetworking::Profile", dependent: :destroy validates :email, presence: true, if: "contact_preference == 'email'" validates :phone_number, presence: true, if: :phone_number? private def phone_number? %w(sms phone).include?(contact_preference) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems